2 ===================================================================
3 RCS file: /cvs/root/Libc/gen/FreeBSD/nice.c,v
4 retrieving revision 1.2
5 diff -u -d -b -w -p -r1.2 nice.c
6 --- nice.c 2003/05/20 22:21:02 1.2
7 +++ nice.c 2005/04/06 22:28:10
8 @@ -42,7 +42,9 @@ __FBSDID("$FreeBSD: src/lib/libc/gen/nic
9 #include <sys/resource.h>
15 +#endif /* __DARWIN_UNIX03 */
17 * Backwards compatible nice.
19 @@ -50,11 +52,18 @@ int
27 prio = getpriority(PRIO_PROCESS, 0);
28 if (prio == -1 && errno)
30 - return (setpriority(PRIO_PROCESS, 0, prio + incr));
32 + if (prio + incr > NZERO-1)
33 + incr = NZERO-1-prio;
34 +#endif /* __DARWIN_UNIX03 */
35 + rv = setpriority(PRIO_PROCESS, 0, prio + incr);
36 + if (rv == -1 && errno == EACCES)
38 + return (rv == -1) ? rv : getpriority(PRIO_PROCESS, 0);