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: christos%zoulas.com@localhost (Christos Zoulas)
To: gnats-bugs%NetBSD.org@localhost, lib-bug-people%netbsd.org@localhost, 
        gnats-admin%netbsd.org@localhost, netbsd-bugs%netbsd.org@localhost, 
ekamperi%gmail.com@localhost
Cc: 
Subject: Re: lib/42587: nice() returns EACCES instead of (standard mandated) 
EPERM
Date: Sat, 30 Apr 2011 22:36:22 -0400

 On May 1,  2:30am, dholland-bugs%netbsd.org@localhost (David Holland) wrote:
 -- Subject: Re: lib/42587: nice() returns EACCES instead of (standard mandate
 
 | The following reply was made to PR lib/42587; it has been noted by GNATS.
 | 
 |  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));
 
 You need to do it in setpriority, since getpriority cannot fail with EACCES...
 I should fix the man page too.
 
 christos
 


Home | Main Index | Thread Index | Old Index