As documented, return the new priority if successful; from Matthias

Drochner in PR lib/17156.
This commit is contained in:
kleink 2002-06-04 10:58:12 +00:00
parent fb9b52398c
commit 7965e254cb
1 changed files with 7 additions and 4 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: nice.c,v 1.9 2000/01/22 22:19:11 mycroft Exp $ */
/* $NetBSD: nice.c,v 1.10 2002/06/04 10:58:12 kleink Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)nice.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: nice.c,v 1.9 2000/01/22 22:19:11 mycroft Exp $");
__RCSID("$NetBSD: nice.c,v 1.10 2002/06/04 10:58:12 kleink Exp $");
#endif
#endif /* LIBC_SCCS and not lint */
@ -60,11 +60,14 @@ int
nice(incr)
int incr;
{
int prio;
int prio, newprio;
errno = 0;
prio = getpriority(PRIO_PROCESS, 0);
if (prio == -1 && errno)
return (-1);
return (setpriority(PRIO_PROCESS, 0, prio + incr));
newprio = prio + incr;
if (setpriority(PRIO_PROCESS, 0, newprio) != 0)
return (-1);
return (newprio);
}