NetBSD-Bugs archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
Re: lib/42587: nice() returns EACCES instead of (standard mandated) EPERM
The following reply was made to PR lib/42587; it has been noted by GNATS.
From: David Holland <dholland-bugs%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc:
Subject: Re: lib/42587: nice() returns EACCES instead of (standard mandated)
EPERM
Date: Sun, 1 May 2011 04:24:16 +0000
On Sun, May 01, 2011 at 02:40:05AM +0000, Christos Zoulas wrote:
> You need to do it in setpriority, since getpriority cannot fail with
EACCES...
> I should fix the man page too.
oops that was dumb.
Index: nice.c
===================================================================
RCS file: /cvsroot/src/lib/libc/gen/nice.c,v
retrieving revision 1.12
diff -u -p -r1.12 nice.c
--- nice.c 7 Aug 2003 16:42:53 -0000 1.12
+++ nice.c 1 May 2011 04:23:43 -0000
@@ -62,7 +62,10 @@ nice(incr)
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1 && errno)
return (-1);
- if (setpriority(PRIO_PROCESS, 0, prio + incr) != 0)
+ if (setpriority(PRIO_PROCESS, 0, prio + incr) != 0) {
+ if (errno == EACCES)
+ errno = EPERM;
return (-1);
+ }
return (getpriority(PRIO_PROCESS, 0));
}
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index