From 2d19b61a385ff9e2218aacb1109f95962dc9397e Mon Sep 17 00:00:00 2001 From: Marc Di Luzio Date: Mon, 13 May 2019 18:43:11 +0100 Subject: [PATCH] Always log when getpriority fails - we will likely want to know --- daemon/gamemode-sched.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/daemon/gamemode-sched.c b/daemon/gamemode-sched.c index 9969615..156c9f3 100644 --- a/daemon/gamemode-sched.c +++ b/daemon/gamemode-sched.c @@ -121,11 +121,13 @@ void game_mode_apply_renice(const GameModeContext *self, const pid_t client, int /* Clear errno as -1 is a regitimate return */ errno = 0; int prio = getpriority(PRIO_PROCESS, (id_t)tid); + if (prio == -1 && errno) { - /* process has likely ended, only log an error if we were actually trying to set a - * non-zero value */ - if (errno == ESRCH && renice != 0) - LOG_ERROR("getpriority returned ESRCH for process %d\n", tid); + /* Process may well have ended */ + LOG_ERROR("getpriority failed for client [%d,%d] with error: %s\n", + client, + tid, + strerror(errno)); } else if (prio != expected) { /* * Don't adjust priority if it does not match the expected value