aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--toys/nice.c5
1 files changed, 2 insertions, 3 deletions
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);
}