Subject: bin/10227: Renice(1) can't alter -1 priority of a process.
To: None <gnats-bugs@gnats.netbsd.org>
From: Takahiro Kambe <taca@sky.yamashina.kyoto.jp>
List: netbsd-bugs
Date: 05/29/2000 09:14:12
>Number:         10227
>Category:       bin
>Synopsis:       Renice(1) can't alter -1 priority of a process.
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon May 29 09:15:00 PDT 2000
>Closed-Date:
>Last-Modified:
>Originator:     Takahiro Kambe
>Release:        <etBSD-current 2000/5/28
>Organization:
	
>Environment:
	
System: NetBSD edge.sky.yamashina.kyoto.jp 1.4Z NetBSD 1.4Z (CF-M33) #27: Mon May 29 01:58:14 JST 2000 taca@edge.sky.yamashina.kyoto.jp:/usr/src/sys/arch/i386/compile/CF-M33 i386


>Description:
	Renice(1) can't alter -1 priority of a process.
>How-To-Repeat:

	root@land[316]:sleep 50 &
	[1] 28631
	root@land[317]:renice -1 28631
	28631: old priority 0, new priority -1
	root@land[318]:renice -1 28631
	renice: 28631: getpriority: Undefined error: 0

>Fix:
	Getpriority(2) returns -1 on success and manual says check the error
	with errno.


--- renice.c.orig	Mon Mar 20 23:39:19 2000
+++ renice.c	Tue May 30 01:09:28 2000
@@ -148,7 +148,8 @@
 {
 	int oldprio;
 
-	if ((oldprio = getpriority(which, who)) == -1) {
+	errno = 0;
+	if ((oldprio = getpriority(which, who)) == -1 && errno != 0) {
 		warn("%d: getpriority", who);
 		return (1);
 	}

>Release-Note:
>Audit-Trail:
>Unformatted: