Mercurial > hg > toybox
changeset 649:2364ace48ab1
Bugfix from Avery Pennarun: getpriority() uses a different range than nice(), so follow thenice man page and zero errno then check it if nice returns -1.
author | Rob Landley <rob@landley.net> |
---|---|
date | Thu, 16 Aug 2012 22:24:30 -0500 |
parents | 131571cf708c |
children | dd82e0b28eda |
files | toys/nice.c |
diffstat | 1 files changed, 2 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/toys/nice.c Wed Aug 15 12:53:54 2012 +0200 +++ b/toys/nice.c Thu Aug 16 22:24:30 2012 -0500 @@ -34,9 +34,8 @@ { if (!toys.optflags) TT.priority = 10; - nice(TT.priority); - if (getpriority(PRIO_PROCESS, getpid()) != TT.priority) - perror_exit("Can't set priority"); + errno = 0; + if (nice(TT.priority)==-1 && errno) perror_exit("Can't set priority"); xexec(toys.optargs); }