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