mirror of
https://github.com/troglobit/finit.git
synced 2026-10-01 05:22:48 +07:00
Improved logging on failure to execvp() in forked child
The execvp() call always fails with -1, so only logging exit code when collecting the PID is not enough. When debugging the user needs to see the errno from execvp(), e.g., "No such file or directory", when the command was missing the absolute path to the executable. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
+3
-1
@@ -790,7 +790,7 @@ static int service_start(svc_t *svc)
|
||||
*/
|
||||
pid = setsid();
|
||||
if (pid < 1)
|
||||
logit(LOG_ERR, "failed setsid(), pid %d: %s", pid, strerror(errno));
|
||||
syslog(LOG_ERR, "failed setsid(), pid %d: %s", pid, strerror(errno));
|
||||
|
||||
sig_unblock();
|
||||
|
||||
@@ -801,6 +801,8 @@ static int service_start(svc_t *svc)
|
||||
else
|
||||
status = execvp(args[0], &args[1]);
|
||||
|
||||
syslog(LOG_ERR, "failed starting %s, exit code %d: %s", svc_ident(svc, NULL, 0),
|
||||
status, strerror(errno));
|
||||
_exit(status);
|
||||
} else if (debug) {
|
||||
dbg("Starting PID %d: %s", svc->pid, cmdline);
|
||||
|
||||
Reference in New Issue
Block a user