start-stop-daemon: properly handle missing pidfile

X-Gentoo-Bug: 639218
X-Gentoo-Bug-URL: https://bugs.gentoo.org/639218
This commit is contained in:
Doug Freed 2017-11-29 15:10:39 -05:00 committed by GitHub
parent 3de6395ae3
commit c84ebb94d1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -657,8 +657,15 @@ int main(int argc, char **argv)
parse_schedule(applet, "0", sig); parse_schedule(applet, "0", sig);
else else
parse_schedule(applet, NULL, sig); parse_schedule(applet, NULL, sig);
if (pidfile) {
pid = get_pid(applet, pidfile);
if (pid == -1)
exit(EXIT_FAILURE);
} else {
pid = 0;
}
i = run_stop_schedule(applet, exec, (const char *const *)margv, i = run_stop_schedule(applet, exec, (const char *const *)margv,
get_pid(applet, pidfile), uid, test, progress, false); pid, uid, test, progress, false);
if (i < 0) if (i < 0)
/* We failed to stop something */ /* We failed to stop something */