Fix segfault in killall5 without -o

Original patch by Platon Ryzhikov <ihummer63@yandex.ru>
This commit is contained in:
sin 2018-06-30 17:31:53 +01:00
parent 2d58716c23
commit 11d2d1faaf
1 changed files with 6 additions and 4 deletions

View File

@ -73,10 +73,12 @@ main(int argc, char *argv[])
SLIST_INIT(&omitpid_head);
for (p = strtok(arg, ","); p; p = strtok(NULL, ",")) {
pe = emalloc(sizeof(*pe));
pe->pid = estrtol(p, 10);
SLIST_INSERT_HEAD(&omitpid_head, pe, entry);
if (oflag) {
for (p = strtok(arg, ","); p; p = strtok(NULL, ",")) {
pe = emalloc(sizeof(*pe));
pe->pid = estrtol(p, 10);
SLIST_INSERT_HEAD(&omitpid_head, pe, entry);
}
}
if (sig != SIGSTOP && sig != SIGCONT)