diff options
| author | Garance A Drosehn <gad@FreeBSD.org> | 2004-06-01 03:01:51 +0000 |
|---|---|---|
| committer | Garance A Drosehn <gad@FreeBSD.org> | 2004-06-01 03:01:51 +0000 |
| commit | de1702f459d5f58bd57b592a51cb9fa303d7733a (patch) | |
| tree | 9e9f8397d6e70700ce2c789d3d9fb9542f9a613b /bin | |
| parent | 36568179e321497c431bd9c3baa9a4d2054e75d4 (diff) | |
Notes
Diffstat (limited to 'bin')
| -rw-r--r-- | bin/ps/ps.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/ps/ps.c b/bin/ps/ps.c index df49ab474c024..90c28af24bf4c 100644 --- a/bin/ps/ps.c +++ b/bin/ps/ps.c @@ -674,9 +674,11 @@ addelem_pid(struct listinfo *inf, const char *elem) char *endp; long tempid; - if (*elem == '\0') - tempid = 0L; - else { + if (*elem == '\0') { + warnx("Invalid (zero-length) process id"); + optfatal = 1; + return (0); /* Do not add this value. */ + } else { errno = 0; tempid = strtol(elem, &endp, 10); if (*endp != '\0' || tempid < 0 || elem == endp) { @@ -787,6 +789,9 @@ add_list(struct listinfo *inf, const char *argp) int toolong; char elemcopy[PATH_MAX]; + if (*argp == 0) + inf->addelem(inf, elemcopy); + while (*argp != '\0') { while (*argp != '\0' && strchr(W_SEP, *argp) != NULL) argp++; |
