supervise-daemon: Fix segfault when executable does not exist

When executable is provided just by name (and therefore searched in a
path), exec_file is reset to NULL every time. exists() handles it being
NULL just fine, but dereferencing it in eerror does not work.

Fixes #326
Fixes #327
This commit is contained in:
Wolf 2019-10-04 15:24:32 +02:00 committed by William Hubbs
parent eb61085951
commit 6deda13754

View File

@ -983,7 +983,7 @@ int main(int argc, char **argv)
} }
if (!exists(exec_file)) { if (!exists(exec_file)) {
eerror("%s: %s does not exist", applet, eerror("%s: %s does not exist", applet,
*exec_file ? exec_file : exec); exec_file ? exec_file : exec);
free(exec_file); free(exec_file);
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }