diff options
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); } |