diff options
author | 2017-01-21 11:30:11 +0000 | |
---|---|---|
committer | 2017-01-21 11:30:11 +0000 | |
commit | 2942c4d1584f021be75a9133e4e07d806a6127a6 (patch) | |
tree | c08b21e43172469737fb1c062d6e155978526d57 | |
parent | Switch include of virtio header from dev/pci/to dev/pv/ (diff) | |
download | wireguard-openbsd-2942c4d1584f021be75a9133e4e07d806a6127a6.tar.xz wireguard-openbsd-2942c4d1584f021be75a9133e4e07d806a6127a6.zip |
Stop calling out to sudo/doas to kill processes. Reliance on system
configuration to perform a racy behaviour is not wise.
ok natano
-rw-r--r-- | usr.bin/make/job.c | 37 |
1 files changed, 1 insertions, 36 deletions
diff --git a/usr.bin/make/job.c b/usr.bin/make/job.c index f5798005887..b0c1a90904f 100644 --- a/usr.bin/make/job.c +++ b/usr.bin/make/job.c @@ -1,4 +1,4 @@ -/* $OpenBSD: job.c,v 1.136 2015/07/28 14:22:26 espie Exp $ */ +/* $OpenBSD: job.c,v 1.137 2017/01/21 11:30:11 deraadt Exp $ */ /* $NetBSD: job.c,v 1.16 1996/11/06 17:59:08 christos Exp $ */ /* @@ -156,7 +156,6 @@ static void setup_signal(int); static void notice_signal(int); static void setup_all_signals(void); static const char *really_kill(Job *, int); -static void kill_with_doas_maybe(pid_t, int, const char *); static void debug_kill_printf(const char *, ...); static void debug_vprintf(const char *, va_list); static void may_remove_target(Job *); @@ -168,37 +167,6 @@ static int dying_signal = 0; const char * basedirectory = NULL; -static void -kill_with_doas_maybe(pid_t pid, int signo, const char *p) -{ - char buf[32]; /* largely enough */ - int sudo; - - for (;*p != '\0'; p++) { - if (*p == 's') - sudo = 1; - else if (*p == 'd') - sudo = 0; - else - continue; - if (sudo && p[1] != 'u' || !sudo && p[1] != 'o') - continue; - p++; - if (sudo && p[1] != 'd' || !sudo && p[1] != 'a') - continue; - p++; - if (sudo && p[1] != 'o' || !sudo && p[1] != 's') - continue; - snprintf(buf, sizeof buf, "%s -n /bin/kill -%d %ld", - sudo ? "sudo" : "doas", - signo, (long)pid); - debug_kill_printf("trying to kill with %s", buf); - system(buf); - return; - } - -} - static const char * really_kill(Job *job, int signo) { @@ -214,9 +182,6 @@ really_kill(Job *job, int signo) if (errno == ESRCH) { job->flags |= JOB_LOST; return "not found"; - } else if (errno == EPERM) { - kill_with_doas_maybe(pid, signo, job->cmd); - return ""; } else return "should not happen"; } |