commit: 36a0ab9054512ade413226fb8e8b28060045e9a4 Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> AuthorDate: Fri Aug 25 16:36:45 2017 +0000 Commit: William Hubbs <williamh <AT> gentoo <DOT> org> CommitDate: Fri Aug 25 16:36:45 2017 +0000 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=36a0ab90
make run_stop_schedule accept a pid instead of a pid file src/rc/rc-schedules.c | 13 +++---------- src/rc/rc-schedules.h | 2 +- src/rc/start-stop-daemon.c | 2 +- 3 files changed, 5 insertions(+), 12 deletions(-) diff --git a/src/rc/rc-schedules.c b/src/rc/rc-schedules.c index 0390ef9c..7eb28372 100644 --- a/src/rc/rc-schedules.c +++ b/src/rc/rc-schedules.c @@ -297,7 +297,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, int run_stop_schedule(const char *applet, const char *exec, const char *const *argv, - const char *pidfile, uid_t uid, + pid_t pid, uid_t uid, bool test, bool progress) { SCHEDULEITEM *item = TAILQ_FIRST(&schedule); @@ -306,14 +306,13 @@ int run_stop_schedule(const char *applet, int nrunning = 0; long nloops, nsecs; struct timespec ts; - pid_t pid = 0; const char *const *p; bool progressed = false; if (exec) einfov("Will stop %s", exec); - if (pidfile) - einfov("Will stop PID in pidfile `%s'", pidfile); + if (pid > 0) + einfov("Will stop PID %d", pid); if (uid) einfov("Will stop processes owned by UID %d", uid); if (argv && *argv) { @@ -328,12 +327,6 @@ int run_stop_schedule(const char *applet, } } - if (pidfile) { - pid = get_pid(applet, pidfile); - if (pid == -1) - return 0; - } - while (item) { switch (item->type) { case SC_GOTO: diff --git a/src/rc/rc-schedules.h b/src/rc/rc-schedules.h index 6bed7916..0a10b381 100644 --- a/src/rc/rc-schedules.h +++ b/src/rc/rc-schedules.h @@ -21,7 +21,7 @@ int do_stop(const char *applet, const char *exec, const char *const *argv, pid_t pid, uid_t uid,int sig, bool test); int run_stop_schedule(const char *applet, const char *exec, const char *const *argv, - const char *pidfile, uid_t uid, + pid_t pid, uid_t uid, bool test, bool progress); #endif diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c index df5b3184..4cda6102 100644 --- a/src/rc/start-stop-daemon.c +++ b/src/rc/start-stop-daemon.c @@ -657,7 +657,7 @@ int main(int argc, char **argv) else parse_schedule(applet, NULL, sig); i = run_stop_schedule(applet, exec, (const char *const *)margv, - pidfile, uid, test, progress); + get_pid(applet, pidfile), uid, test, progress); if (i < 0) /* We failed to stop something */