commit: df027ca4722c8755b23a65db75728b835ccca807
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Thu May 11 16:32:24 2017 +0000
Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu May 11 16:36:42 2017 +0000
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=df027ca4
supervise-daemon: fix our status when we give up on the child process
src/rc/supervise-daemon.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/rc/supervise-daemon.c b/src/rc/supervise-daemon.c
index 76c9d426..13aba1a3 100644
--- a/src/rc/supervise-daemon.c
+++ b/src/rc/supervise-daemon.c
@@ -676,10 +676,12 @@ int main(int argc, char **argv)
* result would be the same. */
if (pidfile && exists(pidfile))
unlink(pidfile);
- if (svcname)
+ if (svcname) {
rc_service_daemon_set(svcname, exec,
(const char *const *)argv,
pidfile, false);
+ rc_service_mark(svcname, RC_SERVICE_STOPPED);
+ }
exit(EXIT_SUCCESS);
}
@@ -780,6 +782,14 @@ int main(int argc, char **argv)
}
}
+ if (pidfile && exists(pidfile))
+ unlink(pidfile);
+ if (svcname) {
+ rc_service_daemon_set(svcname, exec,
+ (const char *const *)argv,
+ pidfile, false);
+ rc_service_mark(svcname, RC_SERVICE_STOPPED);
+ }
exit(EXIT_SUCCESS);
} else if (child_pid == 0)
child_process(exec, argv);