@@ -1670,7 +1670,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1670
1670
}
1671
1671
1672
1672
score , niceErr := proc .Niceness (a .syscaller )
1673
- if ! isBenignProcessErr (niceErr ) {
1673
+ if niceErr != nil && ! isBenignProcessErr (niceErr ) {
1674
1674
debouncer .Warn (ctx , "unable to get proc niceness" ,
1675
1675
slog .F ("cmd" , proc .Cmd ()),
1676
1676
slog .F ("pid" , proc .PID ),
@@ -1689,7 +1689,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1689
1689
1690
1690
if niceErr == nil {
1691
1691
err := proc .SetNiceness (a .syscaller , niceness )
1692
- if ! isBenignProcessErr (err ) {
1692
+ if err != nil && ! isBenignProcessErr (err ) {
1693
1693
debouncer .Warn (ctx , "unable to set proc niceness" ,
1694
1694
slog .F ("cmd" , proc .Cmd ()),
1695
1695
slog .F ("pid" , proc .PID ),
@@ -1703,7 +1703,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1703
1703
if oomScore != unsetOOMScore && oomScore != proc .OOMScoreAdj && ! isCustomOOMScore (agentScore , proc ) {
1704
1704
oomScoreStr := strconv .Itoa (oomScore )
1705
1705
err := afero .WriteFile (a .filesystem , fmt .Sprintf ("/proc/%d/oom_score_adj" , proc .PID ), []byte (oomScoreStr ), 0o644 )
1706
- if ! isBenignProcessErr (err ) {
1706
+ if err != nil && ! isBenignProcessErr (err ) {
1707
1707
debouncer .Warn (ctx , "unable to set oom_score_adj" ,
1708
1708
slog .F ("cmd" , proc .Cmd ()),
1709
1709
slog .F ("pid" , proc .PID ),
0 commit comments