From 734206bd09aaba9c3175be557e4f35b095df1ccf Mon Sep 17 00:00:00 2001 From: Rob Landley Date: Thu, 16 Aug 2012 22:24:30 -0500 Subject: 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. --- toys/nice.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'toys') diff --git a/toys/nice.c b/toys/nice.c index 0be74886..84975dfc 100644 --- a/toys/nice.c +++ b/toys/nice.c @@ -34,9 +34,8 @@ void nice_main(void) { 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); } -- cgit v1.2.3