supervise-daemon: log the command line we run to spawn the child process

This commit is contained in:
William Hubbs 2017-10-26 13:57:04 -05:00
parent bb9c481f02
commit d019f34a83

View File

@ -556,6 +556,7 @@ int main(int argc, char **argv)
int child_argc = 0; int child_argc = 0;
char **child_argv = NULL; char **child_argv = NULL;
char *str = NULL; char *str = NULL;
char cmdline[PATH_MAX];
applet = basename_c(argv[0]); applet = basename_c(argv[0]);
atexit(cleanup); atexit(cleanup);
@ -721,6 +722,13 @@ int main(int argc, char **argv)
if (!pidfile && !reexec) if (!pidfile && !reexec)
eerrorx("%s: --pidfile must be specified", applet); eerrorx("%s: --pidfile must be specified", applet);
*cmdline = '\0';
c = argv;
while (c && *c) {
strcat(cmdline, *c);
strcat(cmdline, " ");
c++;
}
endpwent(); endpwent();
argc -= optind; argc -= optind;
argv += optind; argv += optind;
@ -818,6 +826,7 @@ int main(int argc, char **argv)
parse_schedule(applet, NULL, sig); parse_schedule(applet, NULL, sig);
einfov("Detaching to start `%s'", exec); einfov("Detaching to start `%s'", exec);
syslog(LOG_INFO, "Running command line: %s", cmdline);
/* Remove existing pidfile */ /* Remove existing pidfile */
if (pidfile) if (pidfile)