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 02:27:46 +0000
On Wed, Jan 06, 2010 at 06:25:02PM +0000, Christos Zoulas wrote:
> | http://nxr.netbsd.org/source/xref/src/sys/kern/kern_resource.c#310
>
> That will break setpriority(2). You need to make the change in nice(3).
any objection to this?
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 02:22:14 -0000
@@ -60,8 +60,11 @@ nice(incr)
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
- if (prio == -1 && errno)
+ if (prio == -1 && errno) {
+ if (errno == EACCES)
+ errno = EPERM;
return (-1);
+ }
if (setpriority(PRIO_PROCESS, 0, prio + incr) != 0)
return (-1);
return (getpriority(PRIO_PROCESS, 0));
--
David A. Holland
dholland%netbsd.org@localhost
Home |
Main Index |
Thread Index |
Old Index