aboutsummaryrefslogtreecommitdiff
path: root/debianutils/start_stop_daemon.c
diff options
context:
space:
mode:
authorAlexander Vickberg <wickbergster@gmail.com>2019-04-27 15:42:41 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2019-04-27 15:43:43 +0200
commit100fa20c68564311cef8f625bcb1b423e96c97d6 (patch)
tree19f01d9e6f4fc35324707f8838de161593516cb6 /debianutils/start_stop_daemon.c
parent1e9a4f56f574471707244db9f7038ad0581dec16 (diff)
downloadbusybox-w32-100fa20c68564311cef8f625bcb1b423e96c97d6.tar.gz
busybox-w32-100fa20c68564311cef8f625bcb1b423e96c97d6.tar.bz2
busybox-w32-100fa20c68564311cef8f625bcb1b423e96c97d6.zip
start-stop-daemon: Fix -x is not required for -K
Commit 088fec36fedff2cd50437c95b7fb430abf8d303c made -x required for all. However it isn't for -K. function old new delta start_stop_daemon_main 1084 1105 +21 packed_usage 33343 33326 -17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 21/-17) Total: 4 bytes Signed-off-by: Alexander Vickberg <wickbergster@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to '')
-rw-r--r--debianutils/start_stop_daemon.c35
1 files changed, 20 insertions, 15 deletions
diff --git a/debianutils/start_stop_daemon.c b/debianutils/start_stop_daemon.c
index 3a4c1044a..72642ae74 100644
--- a/debianutils/start_stop_daemon.c
+++ b/debianutils/start_stop_daemon.c
@@ -94,7 +94,7 @@ Misc options:
94//usage: "\n -n NAME Match processes with NAME" 94//usage: "\n -n NAME Match processes with NAME"
95//usage: "\n in comm field in /proc/PID/stat" 95//usage: "\n in comm field in /proc/PID/stat"
96//usage: "\n -x EXECUTABLE Match processes with this command" 96//usage: "\n -x EXECUTABLE Match processes with this command"
97//usage: "\n command in /proc/PID/cmdline" 97//usage: "\n in /proc/PID/cmdline"
98//usage: "\n -p FILE Match a process with PID from FILE" 98//usage: "\n -p FILE Match a process with PID from FILE"
99//usage: "\n All specified conditions must match" 99//usage: "\n All specified conditions must match"
100//usage: "\n-S only:" 100//usage: "\n-S only:"
@@ -452,31 +452,34 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
452// "start-stop-daemon -S -a sleep -- 5" 452// "start-stop-daemon -S -a sleep -- 5"
453// NB: -n option does _not_ behave in this way: this will try to execute "5": 453// NB: -n option does _not_ behave in this way: this will try to execute "5":
454// "start-stop-daemon -S -n sleep -- 5" 454// "start-stop-daemon -S -n sleep -- 5"
455 if (!execname) { /* -x is not given */ 455 if (opt & CTX_START) {
456 execname = startas; 456 if (!execname) { /* -x is not given */
457 if (!execname) { /* neither -x nor -a is given */ 457 execname = startas;
458 execname = argv[0]; 458 if (!execname) { /* neither -x nor -a is given */
459 if (!execname) 459 execname = argv[0];
460 bb_show_usage(); 460 if (!execname)
461 argv++; 461 bb_show_usage();
462 argv++;
463 }
462 } 464 }
465 if (!startas) /* -a is not given: use -x EXECUTABLE or argv[0] */
466 startas = execname;
467 *--argv = startas;
468 }
469 if (execname) {
470 G.execname_sizeof = strlen(execname) + 1;
471 G.execname_cmpbuf = xmalloc(G.execname_sizeof + 1);
463 } 472 }
464 if (!startas) /* -a is not given: use -x EXECUTABLE or argv[0] */
465 startas = execname;
466 *--argv = startas;
467 G.execname_sizeof = strlen(execname) + 1;
468 G.execname_cmpbuf = xmalloc(G.execname_sizeof + 1);
469
470// IF_FEATURE_START_STOP_DAEMON_FANCY( 473// IF_FEATURE_START_STOP_DAEMON_FANCY(
471// if (retry_arg) 474// if (retry_arg)
472// retries = xatoi_positive(retry_arg); 475// retries = xatoi_positive(retry_arg);
473// ) 476// )
474
475 if (userspec) { 477 if (userspec) {
476 user_id = bb_strtou(userspec, NULL, 10); 478 user_id = bb_strtou(userspec, NULL, 10);
477 if (errno) 479 if (errno)
478 user_id = xuname2uid(userspec); 480 user_id = xuname2uid(userspec);
479 } 481 }
482
480 /* Both start and stop need to know current processes */ 483 /* Both start and stop need to know current processes */
481 do_procinit(); 484 do_procinit();
482 485
@@ -485,6 +488,8 @@ int start_stop_daemon_main(int argc UNUSED_PARAM, char **argv)
485 return (opt & OPT_OKNODO) ? 0 : (i <= 0); 488 return (opt & OPT_OKNODO) ? 0 : (i <= 0);
486 } 489 }
487 490
491 /* else: CTX_START (-S). execname can't be NULL. */
492
488 if (G.found_procs) { 493 if (G.found_procs) {
489 if (!QUIET) 494 if (!QUIET)
490 printf("%s is already running\n", execname); 495 printf("%s is already running\n", execname);