aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Miles <wmiles@sgl.com>2015-03-13 12:34:29 -0400
committerWilliam Hubbs <w.d.hubbs@gmail.com>2015-03-24 15:52:19 -0500
commitc1faafcad8197a821282b8e56a10132e27eb5d9f (patch)
tree5f55a5f23f1705c135da63f68b0bd692c5729969
parentde93587affb17675e6f7cab2b85613d61e11b98b (diff)
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.
-rw-r--r--src/rc/start-stop-daemon.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/rc/start-stop-daemon.c b/src/rc/start-stop-daemon.c
index 3afbf2e8..7919835b 100644
--- a/src/rc/start-stop-daemon.c
+++ b/src/rc/start-stop-daemon.c
@@ -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)