diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-03 22:32:05 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 2002-06-03 22:32:05 +0000 |
commit | ac25eaa91a8c04124f5331584a2057642504ccf2 (patch) | |
tree | ba9cc6edd933e35bc0f312f537ee0a357bd016f1 /lib/libc/gen/nice.c | |
parent | 9c07526c7d465ea61369d3c84fe297ea550e768f (diff) |
Make nice(3) standards compliant; adapted from patch by Matthias Drochner
While I'm here correct the lies in the manual page.
Diffstat (limited to 'lib/libc/gen/nice.c')
-rw-r--r-- | lib/libc/gen/nice.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/lib/libc/gen/nice.c b/lib/libc/gen/nice.c index b6a95079fa6..6c312a1da29 100644 --- a/lib/libc/gen/nice.c +++ b/lib/libc/gen/nice.c @@ -32,7 +32,7 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -static char rcsid[] = "$OpenBSD: nice.c,v 1.3 1998/05/06 23:11:43 deraadt Exp $"; +static char rcsid[] = "$OpenBSD: nice.c,v 1.4 2002/06/03 22:32:04 millert Exp $"; #endif /* LIBC_SCCS and not lint */ #include <sys/types.h> @@ -42,7 +42,7 @@ static char rcsid[] = "$OpenBSD: nice.c,v 1.3 1998/05/06 23:11:43 deraadt Exp $" #include <unistd.h> /* - * Backwards compatible nice. + * Backwards compatible nice(). */ int nice(incr) @@ -54,5 +54,8 @@ nice(incr) prio = getpriority(PRIO_PROCESS, 0); if (prio == -1 && errno) return (-1); - return (setpriority(PRIO_PROCESS, 0, prio + incr)); + prio += incr; + if (setpriority(PRIO_PROCESS, 0, prio) != 0) + return (-1); + return (prio); } |