commit 11d2d1faaf9cd0e2b6796c17390137dedcdc90bb
parent 2d58716c23f946a84a941579ede6508f0b133361
Author: sin <sin@2f30.org>
Date: Sat, 30 Jun 2018 17:31:53 +0100
Fix segfault in killall5 without -o
Original patch by Platon Ryzhikov <ihummer63@yandex.ru>
Diffstat:
1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/killall5.c b/killall5.c
@@ -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)