summaryrefslogtreecommitdiff
path: root/usr.bin/renice
diff options
context:
space:
mode:
authorTim J. Robbins <tjr@FreeBSD.org>2002-05-16 23:44:11 +0000
committerTim J. Robbins <tjr@FreeBSD.org>2002-05-16 23:44:11 +0000
commitae5a6820667144c38d9ccae373d2b0e9393dad5b (patch)
tree59177d2c0291f1b5ad2e978aa21c40c12a8f02b1 /usr.bin/renice
parent03ed70f315962c5c64b5c28b9c357e2067c9ce5b (diff)
downloadsrc-test-ae5a6820667144c38d9ccae373d2b0e9393dad5b.tar.gz
src-test-ae5a6820667144c38d9ccae373d2b0e9393dad5b.zip
Accept decimal user IDs with -u option as well as usernames.
PR: 36950
Notes
Notes: svn path=/head/; revision=96763
Diffstat (limited to 'usr.bin/renice')
-rw-r--r--usr.bin/renice/renice.84
-rw-r--r--usr.bin/renice/renice.c10
2 files changed, 8 insertions, 6 deletions
diff --git a/usr.bin/renice/renice.8 b/usr.bin/renice/renice.8
index 56d431ef91da5..fc349d1c9e362 100644
--- a/usr.bin/renice/renice.8
+++ b/usr.bin/renice/renice.8
@@ -63,7 +63,7 @@ scheduling priority of one or more running processes.
The following
.Ar who
parameters are interpreted as process ID's, process group
-ID's, or user names.
+ID's, user ID's or user names.
.Nm Renice Ns 'ing
a process group causes all processes in the process group
to have their scheduling priority altered.
@@ -87,7 +87,7 @@ the current priority of each process.
.It Fl u
Force the
.Ar who
-parameters to be interpreted as user names.
+parameters to be interpreted as user names or user ID's.
.It Fl p
Resets the
.Ar who
diff --git a/usr.bin/renice/renice.c b/usr.bin/renice/renice.c
index effa8cf507f7d..71c7087faa347 100644
--- a/usr.bin/renice/renice.c
+++ b/usr.bin/renice/renice.c
@@ -102,12 +102,14 @@ main(int argc, char *argv[])
continue;
}
if (which == PRIO_USER) {
- pwd = getpwnam(*argv);
- if (pwd == NULL) {
- warnx("%s: unknown user", *argv);
+ if ((pwd = getpwnam(*argv)) != NULL)
+ who = pwd->pw_uid;
+ else if (getnum("uid", *argv, &who))
+ continue;
+ else if (who < 0) {
+ warnx("%s: bad value", *argv);
continue;
}
- who = pwd->pw_uid;
} else {
if (getnum("pid", *argv, &who))
continue;