# HG changeset patch # User Rob Landley # Date 1345173870 18000 # Node ID 2364ace48ab121cdc377f2575064663f59e5b5a9 # Parent 131571cf708c03065d1f1f4417c0bea27b4bcae2 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. diff -r 131571cf708c -r 2364ace48ab1 toys/nice.c --- 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); }