@@ -1674,7 +1674,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1674
1674
}
1675
1675
1676
1676
score , niceErr := proc .Niceness (a .syscaller )
1677
- if ! isBenignProcessErr (niceErr ) {
1677
+ if niceErr != nil && ! isBenignProcessErr (niceErr ) {
1678
1678
debouncer .Warn (ctx , "unable to get proc niceness" ,
1679
1679
slog .F ("cmd" , proc .Cmd ()),
1680
1680
slog .F ("pid" , proc .PID ),
@@ -1693,7 +1693,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1693
1693
1694
1694
if niceErr == nil {
1695
1695
err := proc .SetNiceness (a .syscaller , niceness )
1696
- if ! isBenignProcessErr (err ) {
1696
+ if err != nil && ! isBenignProcessErr (err ) {
1697
1697
debouncer .Warn (ctx , "unable to set proc niceness" ,
1698
1698
slog .F ("cmd" , proc .Cmd ()),
1699
1699
slog .F ("pid" , proc .PID ),
@@ -1707,7 +1707,7 @@ func (a *agent) manageProcessPriority(ctx context.Context, debouncer *logDebounc
1707
1707
if oomScore != unsetOOMScore && oomScore != proc .OOMScoreAdj && ! isCustomOOMScore (agentScore , proc ) {
1708
1708
oomScoreStr := strconv .Itoa (oomScore )
1709
1709
err := afero .WriteFile (a .filesystem , fmt .Sprintf ("/proc/%d/oom_score_adj" , proc .PID ), []byte (oomScoreStr ), 0o644 )
1710
- if ! isBenignProcessErr (err ) {
1710
+ if err != nil && ! isBenignProcessErr (err ) {
1711
1711
debouncer .Warn (ctx , "unable to set oom_score_adj" ,
1712
1712
slog .F ("cmd" , proc .Cmd ()),
1713
1713
slog .F ("pid" , proc .PID ),
0 commit comments