summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-07-27 14:56:09 +0200
committerRoman Perepelitsa <roman.perepelitsa@gmail.com>2020-07-28 11:46:14 +0200
commit41e318727e6fdca70b28431a10a60a73aa6f43bf (patch)
tree389700bc895b74c1acf80059835e44b108e55fb7
parentb01e1aec8e321b7562a15c0164f06c5d0e58e1c6 (diff)
downloadzsh-41e318727e6fdca70b28431a10a60a73aa6f43bf.tar.gz
zsh-41e318727e6fdca70b28431a10a60a73aa6f43bf.zip
46268: suppress a useless compiler warning around nice()
From nice(2): To detect an error, set errno to 0 before the call, and check whether it is nonzero after nice() returns -1.
-rw-r--r--Src/exec.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/Src/exec.c b/Src/exec.c
index 7120a2c34..ecad923de 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2789,8 +2789,7 @@ execcmd_fork(Estate state, int how, int type, Wordcode varspc,
/* Check if we should run background jobs at a lower priority. */
if ((how & Z_ASYNC) && isset(BGNICE)) {
errno = 0;
- nice(5);
- if (errno)
+ if (nice(5) == -1 && errno)
zwarn("nice(5) failed: %e", errno);
}
#endif /* HAVE_NICE */