Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/lib/libc/gen nice should always return EPERM, not EACCES
details: https://anonhg.NetBSD.org/src/rev/99a20ab16d11
branches: trunk
changeset: 764692:99a20ab16d11
user: christos <christos%NetBSD.org@localhost>
date: Sun May 01 02:49:54 2011 +0000
description:
nice should always return EPERM, not EACCES
diffstat:
lib/libc/gen/nice.c | 18 ++++++++++--------
1 files changed, 10 insertions(+), 8 deletions(-)
diffs (43 lines):
diff -r 9ffc729a013a -r 99a20ab16d11 lib/libc/gen/nice.c
--- a/lib/libc/gen/nice.c Sun May 01 02:46:19 2011 +0000
+++ b/lib/libc/gen/nice.c Sun May 01 02:49:54 2011 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: nice.c,v 1.12 2003/08/07 16:42:53 agc Exp $ */
+/* $NetBSD: nice.c,v 1.13 2011/05/01 02:49:54 christos Exp $ */
/*
* Copyright (c) 1983, 1993
@@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)nice.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: nice.c,v 1.12 2003/08/07 16:42:53 agc Exp $");
+__RCSID("$NetBSD: nice.c,v 1.13 2011/05/01 02:49:54 christos Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@@ -53,16 +53,18 @@
* Backwards compatible nice.
*/
int
-nice(incr)
- int incr;
+nice(int incr)
{
int prio;
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1 && errno)
- return (-1);
- if (setpriority(PRIO_PROCESS, 0, prio + incr) != 0)
- return (-1);
- return (getpriority(PRIO_PROCESS, 0));
+ return -1;
+ if (setpriority(PRIO_PROCESS, 0, prio + incr) == -1) {
+ if (errno == EACCES)
+ errno = EPERM;
+ return -1;
+ }
+ return getpriority(PRIO_PROCESS, 0);
}
Home |
Main Index |
Thread Index |
Old Index