start-stop-daemon: Fix regression for --test

The previous fix to --test (PR #34) prevented reading one too many
arguments when --exec -or --name was not specified, but created a
regression where the last argument would not print if either of those
arguments was specified. This corrects the issue.

Fixes #41.
This commit is contained in:
Will Miles 2015-03-13 12:34:29 -04:00 committed by William Hubbs
parent de93587aff
commit c1faafcad8

View File

@ -919,10 +919,13 @@ start_stop_daemon(int argc, char **argv)
exec = name;
if (name && start)
*argv = name;
} else if (name)
} else if (name) {
*--argv = name;
else if (exec)
++argc;
} else if (exec) {
*--argv = exec;
++argc;
};
if (stop || sig != -1) {
if (sig == -1)