diff options
author | William Hubbs <w.d.hubbs@gmail.com> | 2017-11-07 15:30:21 -0600 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2017-11-07 15:30:34 -0600 |
commit | 90d9ea656ff7c6b5d618df4e4261ebfa4033f1a8 (patch) | |
tree | 85d9ffb3c2f7a90eff03df6874444995768a4956 /src | |
parent | a3d1c8a0e7d5586be13e2cd9b5029fd729bc1594 (diff) |
start-stop-daemon: do not use do_stop to verify whether a daemon is running
X-Gentoo-Bug: 636574
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=636574
Diffstat (limited to 'src')
-rw-r--r-- | src/rc/start-stop-daemon.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index dab8b3b1..e98f8ba3 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -279,6 +279,7 @@ int main(int argc, char **argv) int stdout_fd; int stderr_fd; pid_t pid, spid; + RC_PIDLIST *pids; int i; char *svcname = getenv("RC_SVCNAME"); RC_STRINGLIST *env_list; @@ -683,10 +684,14 @@ int main(int argc, char **argv) else pid = 0; - if (do_stop(applet, exec, (const char * const *)margv, pid, uid, - 0, test, false) > 0) + if (pid) + pids = rc_find_pids(NULL, NULL, 0, pid); + else + pids = rc_find_pids(exec, (const char * const *) argv, uid, 0); + if (pids) eerrorx("%s: %s is already running", applet, exec); + free(pids); if (test) { if (rc_yesno(getenv("EINFO_QUIET"))) exit (EXIT_SUCCESS); |