NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

lib/42587: nice() returns EACCES instead of (standard mandated) EPERM



>Number:         42587
>Category:       lib
>Synopsis:       nice() returns EACCES instead of (standard mandated) EPERM
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    lib-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Jan 06 15:45:00 +0000 2010
>Originator:     Stathis Kamperis
>Release:        5.0.1
>Organization:
>Environment:
NetBSD 5.0.1 GENERIC/i386 (sorry, handwritter :-))
>Description:
Quoting from (same applies to Issue 7):
http://www.opengroup.org/onlinepubs/000095399/functions/nice.html

The nice() function shall fail if:
[EPERM]
    The incr argument is negative and the calling process does not have
     appropriate privileges.

Linux + OpenSolaris do it right. *BSD I tried return wrong error code.


>How-To-Repeat:
Call nice(-2) from a non-privileged program and check errno variable. It is 
EACCES, instead of EPERM.


Trivial test case here may be found here:
http://gitweb.dragonflybsd.org/~beket/pcca-tests.git/blob_plain/master:/unistd.h/t_nice.c
>Fix:
http://nxr.netbsd.org/source/xref/src/sys/kern/kern_resource.c#310

Replace EACCES with EPERM here.



Home | Main Index | Thread Index | Old Index