summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author_RuRo_ (Андрей Стоцкий) <ruro.ruro@ya.ru>2019-10-16 19:26:06 +0300
committerPeter Stephenson <p.stephenson@samsung.com>2019-10-16 17:41:41 +0100
commit59901e61cb3e7c8c36bb77c722102e2b9504dc5c (patch)
tree97dcf428ad630ea5b9ba5c33c87e67f9accb58dc
parent1156b2aa4444e4c9f66488cc134887faf2c01f74 (diff)
downloadzsh-59901e61cb3e7c8c36bb77c722102e2b9504dc5c.tar.gz
zsh-59901e61cb3e7c8c36bb77c722102e2b9504dc5c.zip
44841: Better checking of errors from "nice"
-rw-r--r--ChangeLog5
-rw-r--r--Src/exec.c7
2 files changed, 10 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index c7695c09d..870774090 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2019-10-16 Peter Stephenson <p.stephenson@samsung.com>
+
+ * _RuRo_ (Андрей Стоцкий): 44841: Src/exec.c: Better error
+ checking of nice, since return value can be negative.
+
2019-10-14 Daniel Shahaf <d.s@daniel.shahaf.name>
* 44812: Completion/Unix/Command/_subversion: Fix syntax error
diff --git a/Src/exec.c b/Src/exec.c
index e81053d67..6014ec9a5 100644
--- a/Src/exec.c
+++ b/Src/exec.c
@@ -2765,9 +2765,12 @@ execcmd_fork(Estate state, int how, int type, Wordcode varspc,
sigtrapped[SIGEXIT] = 0;
#ifdef HAVE_NICE
/* Check if we should run background jobs at a lower priority. */
- if ((how & Z_ASYNC) && isset(BGNICE))
- if (nice(5) < 0)
+ if ((how & Z_ASYNC) && isset(BGNICE)) {
+ errno = 0;
+ nice(5);
+ if (errno)
zwarn("nice(5) failed: %e", errno);
+ }
#endif /* HAVE_NICE */
return 0;