aboutsummaryrefslogtreecommitdiffstats
path: root/svcscan.c
diff options
context:
space:
mode:
Diffstat (limited to 'svcscan.c')
-rw-r--r--svcscan.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/svcscan.c b/svcscan.c
index 7834fdb..a0a5a10 100644
--- a/svcscan.c
+++ b/svcscan.c
@@ -231,10 +231,10 @@ reap_all()
r = waitpid(-1, NULL, WNOHANG);
if (r == 0) {
- m++;
if (m >= 3)
break;
sleep(1);
+ m++;
}
if (r == -1) {
@@ -405,7 +405,6 @@ main(int argc, char **argv)
struct kevent evt[6], revt[6];
struct procctl_reaper_kill rk;
struct procctl_reaper_status rs;
- pid_t mypid = getpid();
if (argc > 1)
supdir = argv[1];
@@ -417,7 +416,7 @@ main(int argc, char **argv)
setup_signals();
- if (procctl(P_PID, mypid, PROC_REAP_ACQUIRE, NULL) == -1)
+ if (procctl(P_PID, getpid(), PROC_REAP_ACQUIRE, NULL) == -1)
err(1, "procctl()");
dir_fd = open(supdir, O_RDONLY | O_DIRECTORY | O_CLOEXEC);
@@ -477,11 +476,11 @@ main(int argc, char **argv)
}
end:
- if (procctl(P_PID, mypid, PROC_REAP_STATUS, &rs) != -1) {
+ if (procctl(P_PID, getpid(), PROC_REAP_STATUS, &rs) != -1) {
if (rs.rs_children > 0) {
rk.rk_sig = SIGTERM;
rk.rk_flags = REAPER_KILL_CHILDREN;
- if (procctl(P_PID, mypid, PROC_REAP_KILL, &rk))
+ if (procctl(P_PID, getpid(), PROC_REAP_KILL, &rk))
perror("procctl()");
}
} else {