diff options
Diffstat (limited to 'debianutils')
| -rw-r--r-- | debianutils/Config.in | 8 | ||||
| -rw-r--r-- | debianutils/Makefile.in | 1 | ||||
| -rw-r--r-- | debianutils/run_parts.c | 56 |
3 files changed, 40 insertions, 25 deletions
diff --git a/debianutils/Config.in b/debianutils/Config.in index 108cc5388..8bdb91f26 100644 --- a/debianutils/Config.in +++ b/debianutils/Config.in | |||
| @@ -33,6 +33,14 @@ config CONFIG_RUN_PARTS | |||
| 33 | Unless you know that run-parts is used in some of your scripts | 33 | Unless you know that run-parts is used in some of your scripts |
| 34 | you can safely say N here. | 34 | you can safely say N here. |
| 35 | 35 | ||
| 36 | config CONFIG_START_STOP_DAEMON | ||
| 37 | bool "start-stop-daemon" | ||
| 38 | default y | ||
| 39 | help | ||
| 40 | start-stop-daemon is used to control the creation and | ||
| 41 | termination of system-level processes, usually the ones | ||
| 42 | started during the startup of the system. | ||
| 43 | |||
| 36 | config CONFIG_WHICH | 44 | config CONFIG_WHICH |
| 37 | bool "which" | 45 | bool "which" |
| 38 | default n | 46 | default n |
diff --git a/debianutils/Makefile.in b/debianutils/Makefile.in index 313faa0de..8ca05c738 100644 --- a/debianutils/Makefile.in +++ b/debianutils/Makefile.in | |||
| @@ -27,6 +27,7 @@ DEBIANUTILS-y:= | |||
| 27 | DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o | 27 | DEBIANUTILS-$(CONFIG_MKTEMP) += mktemp.o |
| 28 | DEBIANUTILS-$(CONFIG_READLINK) += readlink.o | 28 | DEBIANUTILS-$(CONFIG_READLINK) += readlink.o |
| 29 | DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o | 29 | DEBIANUTILS-$(CONFIG_RUN_PARTS) += run_parts.o |
| 30 | DEBIANUTILS-$(CONFIG_START_STOP_DAEMON) += start_stop_daemon.o | ||
| 30 | DEBIANUTILS-$(CONFIG_WHICH) += which.o | 31 | DEBIANUTILS-$(CONFIG_WHICH) += which.o |
| 31 | 32 | ||
| 32 | libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR) | 33 | libraries-y+=$(DEBIANUTILS_DIR)$(DEBIANUTILS_AR) |
diff --git a/debianutils/run_parts.c b/debianutils/run_parts.c index a941e1fc8..98fd58887 100644 --- a/debianutils/run_parts.c +++ b/debianutils/run_parts.c | |||
| @@ -54,6 +54,13 @@ | |||
| 54 | 54 | ||
| 55 | #include "libbb.h" | 55 | #include "libbb.h" |
| 56 | 56 | ||
| 57 | static const struct option runparts_long_options[] = { | ||
| 58 | { "test", 0, NULL, 't' }, | ||
| 59 | { "umask", 1, NULL, 'u' }, | ||
| 60 | { "arg", 1, NULL, 'a' }, | ||
| 61 | { 0, 0, 0, 0 } | ||
| 62 | }; | ||
| 63 | |||
| 57 | /* run_parts_main */ | 64 | /* run_parts_main */ |
| 58 | /* Process options */ | 65 | /* Process options */ |
| 59 | int run_parts_main(int argc, char **argv) | 66 | int run_parts_main(int argc, char **argv) |
| @@ -65,32 +72,31 @@ int run_parts_main(int argc, char **argv) | |||
| 65 | 72 | ||
| 66 | umask(022); | 73 | umask(022); |
| 67 | 74 | ||
| 68 | while ((opt = getopt(argc, argv, "tu:a:")) != -1) { | 75 | while ((opt = getopt_long (argc, argv, "tu:a:", |
| 76 | runparts_long_options, NULL)) > 0) | ||
| 77 | { | ||
| 69 | switch (opt) { | 78 | switch (opt) { |
| 70 | case 't': /* Enable test mode */ | 79 | /* Enable test mode */ |
| 71 | test_mode = 1; | 80 | case 't': |
| 72 | break; | 81 | test_mode++; |
| 73 | case 'u': /* Set the umask of the programs executed */ | 82 | break; |
| 74 | /* Check and set the umask of the program executed. As stated in the original | 83 | /* Set the umask of the programs executed */ |
| 75 | * run-parts, the octal conversion in libc is not foolproof; it will take the | 84 | case 'u': |
| 76 | * 8 and 9 digits under some circumstances. We'll just have to live with it. | 85 | /* Check and set the umask of the program executed. As stated in the original |
| 77 | */ | 86 | * run-parts, the octal conversion in libc is not foolproof; it will take the |
| 78 | { | 87 | * 8 and 9 digits under some circumstances. We'll just have to live with it. |
| 79 | const unsigned int mask = (unsigned int) strtol(optarg, NULL, 8); | 88 | */ |
| 80 | if (mask > 07777) { | 89 | umask(bb_xgetlarg(optarg, 8, 0, 07777)); |
| 81 | bb_perror_msg_and_die("bad umask value"); | 90 | break; |
| 82 | } | 91 | /* Pass an argument to the programs */ |
| 83 | umask(mask); | 92 | case 'a': |
| 84 | } | 93 | /* Add an argument to the commands that we will call. |
| 85 | break; | 94 | * Called once for every argument. */ |
| 86 | case 'a': /* Pass an argument to the programs */ | 95 | args = xrealloc(args, (argcount + 2) * (sizeof(char *))); |
| 87 | /* Add an argument to the commands that we will call. | 96 | args[argcount++] = optarg; |
| 88 | * Called once for every argument. */ | 97 | break; |
| 89 | args = xrealloc(args, (argcount + 2) * (sizeof(char *))); | 98 | default: |
| 90 | args[argcount++] = optarg; | 99 | bb_show_usage(); |
| 91 | break; | ||
| 92 | default: | ||
| 93 | bb_show_usage(); | ||
| 94 | } | 100 | } |
| 95 | } | 101 | } |
| 96 | 102 | ||
