Remove hard-coded paths to system tools available in $PATH

This patch implemements a new feature of libite v1.9.1, whichp(), which
instead of fexist() that requires an absolute path, searches $PATH.

For reference, see issue #69 and PRs #70 and #72.

Signed-off-by: Joachim Nilsson <troglobit@gmail.com>
This commit is contained in:
Joachim Nilsson committed 2017-07-03 13:13:55 +02:00
1 parent 30822f0d68
commit 9c6e046d93
5 files changed
+23 -24

No files matched your search

+5 -6
View File
@@ -148,17 +148,17 @@ static int service_start(svc_t *svc)
if (!svc)
return 1;
/* Ignore if finit is SIGSTOP'ed */
if (is_norespawn())
return 1;
/* Don't try and start service if it doesn't exist. */
if (!fexist(svc->cmd) && !svc->inetd.cmd) {
if (!whichp(svc->cmd) && !svc->inetd.cmd) {
print(1, "Service %s does not exist!", svc->cmd);
svc_missing(svc);
return 1;
}
/* Ignore if finit is SIGSTOP'ed */
if (is_norespawn())
return 1;
if (svc_is_daemon(svc) || svc_is_inetd(svc))
print_desc("Starting ", svc->desc);
else
@@ -284,7 +284,6 @@ static int service_start(svc_t *svc)
#endif
if (svc->log)
waitpid(pid, NULL, 0);
exit(status);
} else if (log_is_debug()) {
char buf[CMD_SIZE] = "";