procps/procps-v3.3.3-chroot.diff
2012-07-05 08:16:03 +00:00

21 lines
628 B
Diff

--- top/top.c
+++ top/top.c 2012-07-05 07:51:02.384012773 +0000
@@ -1151,9 +1151,15 @@ static const char *user_certify (WIN_t *
Monpidsidx = 0;
if (*str) {
num = (uid_t)strtoul(str, &endp, 0);
- if ('\0' == *endp)
+ if ('\0' == *endp) {
pwd = getpwuid(num);
- else
+ if (!pwd) {
+ /* Allow foreign users from e.g. within chroot environment */
+ q->usrseluid = num;
+ q->usrseltyp = typ;
+ return NULL;
+ }
+ } else
pwd = getpwnam(str);
if (!pwd) return N_txt(BAD_username_txt);
q->usrseluid = pwd->pw_uid;