Hi,

Commit 088fec36fedff2cd50437c95b7fb430abf8d303c made -x required for
all. However it isn't for -K.

Signed-off-by: Alexander Vickberg <[email protected]>

function                                             old     new   delta
start_stop_daemon_main               1341    1352     +11
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 11/0)               Total: 11 bytes
   text    data     bss     dec     hex filename
1020453   17219    1888 1039560   fdcc8 busybox_old
1020464   17219    1888 1039571   fdcd3 busybox_unstripped
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 3a4c1044a..68520df17 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -452,20 +452,24 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
 // "start-stop-daemon -S -a sleep      -- 5"
 // NB: -n option does _not_ behave in this way: this will try to execute "5":
 // "start-stop-daemon -S -n sleep      -- 5"
-	if (!execname) { /* -x is not given */
-		execname = startas;
-		if (!execname) { /* neither -x nor -a is given */
-			execname = argv[0];
-			if (!execname)
-				bb_show_usage();
-			argv++;
+	if ((opt & CTX_START)) {
+		if (!execname) { /* -x is not given */
+			execname = startas;
+			if (!execname) { /* neither -x nor -a is given */
+				execname = argv[0];
+				if (!execname)
+					bb_show_usage();
+				argv++;
+			}
 		}
+		if (!startas) /* -a is not given: use -x EXECUTABLE or argv[0] */
+			startas = execname;
+		*--argv = startas;
+	}
+	if (execname) {
+		G.execname_sizeof = strlen(execname) + 1;
+		G.execname_cmpbuf = xmalloc(G.execname_sizeof + 1);
 	}
-	if (!startas) /* -a is not given: use -x EXECUTABLE or argv[0] */
-		startas = execname;
-	*--argv = startas;
-	G.execname_sizeof = strlen(execname) + 1;
-	G.execname_cmpbuf = xmalloc(G.execname_sizeof + 1);
 
 //	IF_FEATURE_START_STOP_DAEMON_FANCY(
 //		if (retry_arg)
_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to