If we can't change the scheduling priority, warn but still execute

the requested utility. This is how nice(1) traditionall behaved,
and the behaviour required by SUSv3 and POSIX.2 UPE.

Submitted by:	Peter Avalos <pavalos@theshell.com> (partially)
Reviewed by:	mike
This commit is contained in:
tjr 2002-05-13 08:03:20 +00:00
parent 135bb8bda2
commit e54018774d

View File

@ -100,9 +100,9 @@ main(argc, argv)
errno = 0;
niceness += getpriority(PRIO_PROCESS, 0);
if (errno)
err(1, "getpriority");
if (setpriority(PRIO_PROCESS, 0, (int)niceness))
err(1, "setpriority");
warn("getpriority");
else if (setpriority(PRIO_PROCESS, 0, (int)niceness))
warn("setpriority");
execvp(*argv, argv);
err(errno == ENOENT ? 127 : 126, "%s", *argv);
}