diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-10 15:43:37 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-04-10 15:43:37 +0000 |
commit | 99912ca733dd960f5589227fd999c86e73c8e894 (patch) | |
tree | 9df947fc08884d498cf76a02204d74b121064134 | |
parent | ff131b980d524a33d8a43cefe65e14f64a43f2da (diff) | |
download | busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.gz busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.tar.bz2 busybox-w32-99912ca733dd960f5589227fd999c86e73c8e894.zip |
audit small applets and mark some of them as NOFORK.
Put big scary warnings in relevant places.
41 files changed, 173 insertions, 128 deletions
diff --git a/coreutils/basename.c b/coreutils/basename.c index 46f7122c8..f4307d6ce 100644 --- a/coreutils/basename.c +++ b/coreutils/basename.c | |||
@@ -20,11 +20,10 @@ | |||
20 | * 3) Save some space by using strcmp(). Calling strncmp() here was silly. | 20 | * 3) Save some space by using strcmp(). Calling strncmp() here was silly. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <stdlib.h> | ||
24 | #include <stdio.h> | ||
25 | #include <string.h> | ||
26 | #include "busybox.h" | 23 | #include "busybox.h" |
27 | 24 | ||
25 | /* This is a NOFORK applet. Be very careful! */ | ||
26 | |||
28 | int basename_main(int argc, char **argv); | 27 | int basename_main(int argc, char **argv); |
29 | int basename_main(int argc, char **argv) | 28 | int basename_main(int argc, char **argv) |
30 | { | 29 | { |
@@ -47,5 +46,5 @@ int basename_main(int argc, char **argv) | |||
47 | 46 | ||
48 | puts(s); | 47 | puts(s); |
49 | 48 | ||
50 | fflush_stdout_and_exit(EXIT_SUCCESS); | 49 | return fflush(stdout); |
51 | } | 50 | } |
diff --git a/coreutils/cat.c b/coreutils/cat.c index 7bab325ef..eb141dc79 100644 --- a/coreutils/cat.c +++ b/coreutils/cat.c | |||
@@ -12,17 +12,23 @@ | |||
12 | 12 | ||
13 | #include "busybox.h" | 13 | #include "busybox.h" |
14 | 14 | ||
15 | /* This is a NOFORK applet. Be very careful! */ | ||
16 | |||
17 | |||
15 | int bb_cat(char **argv) | 18 | int bb_cat(char **argv) |
16 | { | 19 | { |
17 | static const char *const argv_dash[] = { "-", NULL }; | 20 | static const char *const argv_dash[] = { "-", NULL }; |
21 | |||
18 | FILE *f; | 22 | FILE *f; |
19 | int retval = EXIT_SUCCESS; | 23 | int retval = EXIT_SUCCESS; |
20 | 24 | ||
21 | if (!*argv) argv = (char**) &argv_dash; | 25 | if (!*argv) |
26 | argv = (char**) &argv_dash; | ||
22 | 27 | ||
23 | do { | 28 | do { |
24 | f = fopen_or_warn_stdin(*argv); | 29 | f = fopen_or_warn_stdin(*argv); |
25 | if (f) { | 30 | if (f) { |
31 | /* This is not an xfunc - never exits */ | ||
26 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); | 32 | off_t r = bb_copyfd_eof(fileno(f), STDOUT_FILENO); |
27 | fclose_if_not_stdin(f); | 33 | fclose_if_not_stdin(f); |
28 | if (r >= 0) | 34 | if (r >= 0) |
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c index cfb8c15b2..48014ecdf 100644 --- a/coreutils/chgrp.c +++ b/coreutils/chgrp.c | |||
@@ -13,6 +13,9 @@ | |||
13 | 13 | ||
14 | #include "busybox.h" | 14 | #include "busybox.h" |
15 | 15 | ||
16 | /* This is a NOEXEC applet. Be very careful! */ | ||
17 | |||
18 | |||
16 | int chgrp_main(int argc, char **argv); | 19 | int chgrp_main(int argc, char **argv); |
17 | int chgrp_main(int argc, char **argv) | 20 | int chgrp_main(int argc, char **argv) |
18 | { | 21 | { |
diff --git a/coreutils/chmod.c b/coreutils/chmod.c index 9a73218a1..aa3625877 100644 --- a/coreutils/chmod.c +++ b/coreutils/chmod.c | |||
@@ -16,6 +16,9 @@ | |||
16 | 16 | ||
17 | #include "busybox.h" | 17 | #include "busybox.h" |
18 | 18 | ||
19 | /* This is a NOEXEC applet. Be very careful! */ | ||
20 | |||
21 | |||
19 | #define OPT_RECURSE (option_mask32 & 1) | 22 | #define OPT_RECURSE (option_mask32 & 1) |
20 | #define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0)) | 23 | #define OPT_VERBOSE (USE_DESKTOP(option_mask32 & 2) SKIP_DESKTOP(0)) |
21 | #define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0)) | 24 | #define OPT_CHANGED (USE_DESKTOP(option_mask32 & 4) SKIP_DESKTOP(0)) |
diff --git a/coreutils/chown.c b/coreutils/chown.c index e64a39c3e..71ba81247 100644 --- a/coreutils/chown.c +++ b/coreutils/chown.c | |||
@@ -13,6 +13,9 @@ | |||
13 | 13 | ||
14 | #include "busybox.h" | 14 | #include "busybox.h" |
15 | 15 | ||
16 | /* This is a NOEXEC applet. Be very careful! */ | ||
17 | |||
18 | |||
16 | #define OPT_STR ("Rh" USE_DESKTOP("vcfLHP")) | 19 | #define OPT_STR ("Rh" USE_DESKTOP("vcfLHP")) |
17 | #define BIT_RECURSE 1 | 20 | #define BIT_RECURSE 1 |
18 | #define OPT_RECURSE (option_mask32 & 1) | 21 | #define OPT_RECURSE (option_mask32 & 1) |
diff --git a/coreutils/chroot.c b/coreutils/chroot.c index fcd70f21a..874ee917e 100644 --- a/coreutils/chroot.c +++ b/coreutils/chroot.c | |||
@@ -27,8 +27,9 @@ int chroot_main(int argc, char **argv) | |||
27 | ++argv; | 27 | ++argv; |
28 | if (argc == 2) { | 28 | if (argc == 2) { |
29 | argv -= 2; | 29 | argv -= 2; |
30 | if (!(*argv = getenv("SHELL"))) { | 30 | argv[0] = getenv("SHELL"); |
31 | *argv = (char *) DEFAULT_SHELL; | 31 | if (!argv[0]) { |
32 | argv[0] = (char *) DEFAULT_SHELL; | ||
32 | } | 33 | } |
33 | argv[1] = (char *) "-i"; | 34 | argv[1] = (char *) "-i"; |
34 | } | 35 | } |
diff --git a/coreutils/cp.c b/coreutils/cp.c index a80e0d286..8c0937971 100644 --- a/coreutils/cp.c +++ b/coreutils/cp.c | |||
@@ -18,6 +18,9 @@ | |||
18 | #include "busybox.h" | 18 | #include "busybox.h" |
19 | #include "libcoreutils/coreutils.h" | 19 | #include "libcoreutils/coreutils.h" |
20 | 20 | ||
21 | /* This is a NOEXEC applet. Be very careful! */ | ||
22 | |||
23 | |||
21 | int cp_main(int argc, char **argv); | 24 | int cp_main(int argc, char **argv); |
22 | int cp_main(int argc, char **argv) | 25 | int cp_main(int argc, char **argv) |
23 | { | 26 | { |
diff --git a/coreutils/cut.c b/coreutils/cut.c index 22014fcfb..b9ea3127c 100644 --- a/coreutils/cut.c +++ b/coreutils/cut.c | |||
@@ -11,6 +11,9 @@ | |||
11 | 11 | ||
12 | #include "busybox.h" | 12 | #include "busybox.h" |
13 | 13 | ||
14 | /* This is a NOEXEC applet. Be very careful! */ | ||
15 | |||
16 | |||
14 | /* option vars */ | 17 | /* option vars */ |
15 | static const char optstring[] = "b:c:f:d:sn"; | 18 | static const char optstring[] = "b:c:f:d:sn"; |
16 | #define CUT_OPT_BYTE_FLGS (1<<0) | 19 | #define CUT_OPT_BYTE_FLGS (1<<0) |
diff --git a/coreutils/dd.c b/coreutils/dd.c index 4507b5e0c..34a325ea6 100644 --- a/coreutils/dd.c +++ b/coreutils/dd.c | |||
@@ -8,8 +8,11 @@ | |||
8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 8 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
9 | */ | 9 | */ |
10 | 10 | ||
11 | #include "busybox.h" | ||
12 | #include <signal.h> /* For FEATURE_DD_SIGNAL_HANDLING */ | 11 | #include <signal.h> /* For FEATURE_DD_SIGNAL_HANDLING */ |
12 | #include "busybox.h" | ||
13 | |||
14 | /* This is a NOEXEC applet. Be very careful! */ | ||
15 | |||
13 | 16 | ||
14 | static const struct suffix_mult dd_suffixes[] = { | 17 | static const struct suffix_mult dd_suffixes[] = { |
15 | { "c", 1 }, | 18 | { "c", 1 }, |
diff --git a/coreutils/dirname.c b/coreutils/dirname.c index 4ecde3147..7c5484bfd 100644 --- a/coreutils/dirname.c +++ b/coreutils/dirname.c | |||
@@ -10,10 +10,10 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ |
12 | 12 | ||
13 | #include <stdio.h> | ||
14 | #include <stdlib.h> | ||
15 | #include "busybox.h" | 13 | #include "busybox.h" |
16 | 14 | ||
15 | /* This is a NOFORK applet. Be very careful! */ | ||
16 | |||
17 | int dirname_main(int argc, char **argv); | 17 | int dirname_main(int argc, char **argv); |
18 | int dirname_main(int argc, char **argv) | 18 | int dirname_main(int argc, char **argv) |
19 | { | 19 | { |
@@ -23,5 +23,5 @@ int dirname_main(int argc, char **argv) | |||
23 | 23 | ||
24 | puts(dirname(argv[1])); | 24 | puts(dirname(argv[1])); |
25 | 25 | ||
26 | fflush_stdout_and_exit(EXIT_SUCCESS); | 26 | return fflush(stdout); |
27 | } | 27 | } |
diff --git a/coreutils/false.c b/coreutils/false.c index 2a26e0e28..90d6a0162 100644 --- a/coreutils/false.c +++ b/coreutils/false.c | |||
@@ -10,9 +10,10 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/false.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/false.html */ |
12 | 12 | ||
13 | #include <stdlib.h> | ||
14 | #include "busybox.h" | 13 | #include "busybox.h" |
15 | 14 | ||
15 | /* This is a NOFORK applet. Be very careful! */ | ||
16 | |||
16 | int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv); | 17 | int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv); |
17 | int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) | 18 | int false_main(int ATTRIBUTE_UNUSED argc, char ATTRIBUTE_UNUSED **argv) |
18 | { | 19 | { |
diff --git a/coreutils/hostid.c b/coreutils/hostid.c index 51a76c631..e14f6ca57 100644 --- a/coreutils/hostid.c +++ b/coreutils/hostid.c | |||
@@ -9,10 +9,10 @@ | |||
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ | 10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ |
11 | 11 | ||
12 | #include <stdlib.h> | ||
13 | #include <unistd.h> | ||
14 | #include "busybox.h" | 12 | #include "busybox.h" |
15 | 13 | ||
14 | /* This is a NOFORK applet. Be very careful! */ | ||
15 | |||
16 | int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv); | 16 | int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv); |
17 | int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) | 17 | int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) |
18 | { | 18 | { |
@@ -22,5 +22,5 @@ int hostid_main(int argc, char ATTRIBUTE_UNUSED **argv) | |||
22 | 22 | ||
23 | printf("%lx\n", gethostid()); | 23 | printf("%lx\n", gethostid()); |
24 | 24 | ||
25 | fflush_stdout_and_exit(EXIT_SUCCESS); | 25 | return fflush(stdout); |
26 | } | 26 | } |
diff --git a/coreutils/length.c b/coreutils/length.c index 1dc122cc1..b3a9d4903 100644 --- a/coreutils/length.c +++ b/coreutils/length.c | |||
@@ -2,19 +2,18 @@ | |||
2 | 2 | ||
3 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ | 3 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ |
4 | 4 | ||
5 | #include <stdlib.h> | ||
6 | #include <string.h> | ||
7 | #include <stdio.h> | ||
8 | #include "busybox.h" | 5 | #include "busybox.h" |
9 | 6 | ||
7 | /* This is a NOFORK applet. Be very careful! */ | ||
8 | |||
10 | int length_main(int argc, char **argv); | 9 | int length_main(int argc, char **argv); |
11 | int length_main(int argc, char **argv) | 10 | int length_main(int argc, char **argv) |
12 | { | 11 | { |
13 | if ((argc != 2) || (**(++argv) == '-')) { | 12 | if ((argc != 2) || (**(++argv) == '-')) { |
14 | bb_show_usage(); | 13 | bb_show_usage(); |
15 | } | 14 | } |
16 | 15 | ||
17 | printf("%lu\n", (unsigned long)strlen(*argv)); | 16 | printf("%u\n", (unsigned)strlen(*argv)); |
18 | 17 | ||
19 | fflush_stdout_and_exit(EXIT_SUCCESS); | 18 | return fflush(stdout); |
20 | } | 19 | } |
diff --git a/coreutils/ln.c b/coreutils/ln.c index 720713475..fd4eacec2 100644 --- a/coreutils/ln.c +++ b/coreutils/ln.c | |||
@@ -13,6 +13,9 @@ | |||
13 | 13 | ||
14 | #include "busybox.h" | 14 | #include "busybox.h" |
15 | 15 | ||
16 | /* This is a NOEXEC applet. Be very careful! */ | ||
17 | |||
18 | |||
16 | #define LN_SYMLINK 1 | 19 | #define LN_SYMLINK 1 |
17 | #define LN_FORCE 2 | 20 | #define LN_FORCE 2 |
18 | #define LN_NODEREFERENCE 4 | 21 | #define LN_NODEREFERENCE 4 |
diff --git a/coreutils/logname.c b/coreutils/logname.c index 743e2291c..aba6ce3c6 100644 --- a/coreutils/logname.c +++ b/coreutils/logname.c | |||
@@ -20,23 +20,23 @@ | |||
20 | * a diagnostic message and an error return. | 20 | * a diagnostic message and an error return. |
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <stdio.h> | ||
24 | #include <stdlib.h> | ||
25 | #include <unistd.h> | ||
26 | #include "busybox.h" | 23 | #include "busybox.h" |
27 | 24 | ||
25 | /* This is a NOFORK applet. Be very careful! */ | ||
26 | |||
28 | int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); | 27 | int logname_main(int argc, char ATTRIBUTE_UNUSED **argv); |
29 | int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) | 28 | int logname_main(int argc, char ATTRIBUTE_UNUSED **argv) |
30 | { | 29 | { |
31 | const char *p; | 30 | char buf[128]; |
32 | 31 | ||
33 | if (argc > 1) { | 32 | if (argc > 1) { |
34 | bb_show_usage(); | 33 | bb_show_usage(); |
35 | } | 34 | } |
36 | 35 | ||
37 | if ((p = getlogin()) != NULL) { | 36 | /* Using _r function - avoid pulling in static buffer from libc */ |
38 | puts(p); | 37 | if (getlogin_r(buf, sizeof(buf)) == 0) { |
39 | fflush_stdout_and_exit(EXIT_SUCCESS); | 38 | puts(buf); |
39 | return fflush(stdout); | ||
40 | } | 40 | } |
41 | 41 | ||
42 | bb_perror_msg_and_die("getlogin"); | 42 | bb_perror_msg_and_die("getlogin"); |
diff --git a/coreutils/ls.c b/coreutils/ls.c index 34836ee29..7bbb19d6c 100644 --- a/coreutils/ls.c +++ b/coreutils/ls.c | |||
@@ -29,8 +29,11 @@ | |||
29 | * 1. requires lstat (BSD) - how do you do it without? | 29 | * 1. requires lstat (BSD) - how do you do it without? |
30 | */ | 30 | */ |
31 | 31 | ||
32 | #include "busybox.h" | ||
33 | #include <getopt.h> | 32 | #include <getopt.h> |
33 | #include "busybox.h" | ||
34 | |||
35 | /* This is a NOEXEC applet. Be very careful! */ | ||
36 | |||
34 | 37 | ||
35 | enum { | 38 | enum { |
36 | 39 | ||
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c index 690e4ab40..5a6c9d077 100644 --- a/coreutils/mkdir.c +++ b/coreutils/mkdir.c | |||
@@ -19,19 +19,19 @@ | |||
19 | /* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support. | 19 | /* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | #include <stdlib.h> | ||
23 | #include <unistd.h> | ||
24 | #include <getopt.h> /* struct option */ | 22 | #include <getopt.h> /* struct option */ |
25 | #include "busybox.h" | 23 | #include "busybox.h" |
26 | 24 | ||
25 | /* This is a NOFORK applet. Be very careful! */ | ||
26 | |||
27 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS | 27 | #if ENABLE_FEATURE_MKDIR_LONG_OPTIONS |
28 | static const struct option mkdir_long_options[] = { | 28 | static const struct option mkdir_long_options[] = { |
29 | { "mode", 1, NULL, 'm' }, | 29 | { "mode" , 1, NULL, 'm' }, |
30 | { "parents", 0, NULL, 'p' }, | 30 | { "parents", 0, NULL, 'p' }, |
31 | #if ENABLE_SELINUX | 31 | #if ENABLE_SELINUX |
32 | { "context", 1, NULL, 'Z' }, | 32 | { "context", 1, NULL, 'Z' }, |
33 | #endif | 33 | #endif |
34 | { 0, 0, 0, 0 } | 34 | { NULL, 0, NULL, 0 } |
35 | }; | 35 | }; |
36 | #endif | 36 | #endif |
37 | 37 | ||
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c index 6d8aa413e..7dcc50fa9 100644 --- a/coreutils/mkfifo.c +++ b/coreutils/mkfifo.c | |||
@@ -10,9 +10,6 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ |
12 | 12 | ||
13 | #include <stdlib.h> | ||
14 | #include <unistd.h> | ||
15 | #include <sys/types.h> | ||
16 | #include "busybox.h" | 13 | #include "busybox.h" |
17 | #include "libcoreutils/coreutils.h" | 14 | #include "libcoreutils/coreutils.h" |
18 | 15 | ||
@@ -24,7 +21,8 @@ int mkfifo_main(int argc, char **argv) | |||
24 | 21 | ||
25 | mode = getopt_mk_fifo_nod(argc, argv); | 22 | mode = getopt_mk_fifo_nod(argc, argv); |
26 | 23 | ||
27 | if (!*(argv += optind)) { | 24 | argv += optind; |
25 | if (!*argv) { | ||
28 | bb_show_usage(); | 26 | bb_show_usage(); |
29 | } | 27 | } |
30 | 28 | ||
diff --git a/coreutils/pwd.c b/coreutils/pwd.c index d96f6a8e5..a93b8f115 100644 --- a/coreutils/pwd.c +++ b/coreutils/pwd.c | |||
@@ -7,10 +7,10 @@ | |||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <stdlib.h> | ||
12 | #include "busybox.h" | 10 | #include "busybox.h" |
13 | 11 | ||
12 | /* This is a NOFORK applet. Be very careful! */ | ||
13 | |||
14 | int pwd_main(int argc, char **argv); | 14 | int pwd_main(int argc, char **argv); |
15 | int pwd_main(int argc, char **argv) | 15 | int pwd_main(int argc, char **argv) |
16 | { | 16 | { |
@@ -19,7 +19,8 @@ int pwd_main(int argc, char **argv) | |||
19 | buf = xrealloc_getcwd_or_warn(NULL); | 19 | buf = xrealloc_getcwd_or_warn(NULL); |
20 | if (buf != NULL) { | 20 | if (buf != NULL) { |
21 | puts(buf); | 21 | puts(buf); |
22 | fflush_stdout_and_exit(EXIT_SUCCESS); | 22 | free(buf); |
23 | return fflush(stdout); | ||
23 | } | 24 | } |
24 | 25 | ||
25 | return EXIT_FAILURE; | 26 | return EXIT_FAILURE; |
diff --git a/coreutils/rm.c b/coreutils/rm.c index 1883feed8..6f32e7dc5 100644 --- a/coreutils/rm.c +++ b/coreutils/rm.c | |||
@@ -15,9 +15,10 @@ | |||
15 | * Size reduction. | 15 | * Size reduction. |
16 | */ | 16 | */ |
17 | 17 | ||
18 | #include <unistd.h> | ||
19 | #include "busybox.h" | 18 | #include "busybox.h" |
20 | 19 | ||
20 | /* This is a NOFORK applet. Be very careful! */ | ||
21 | |||
21 | int rm_main(int argc, char **argv); | 22 | int rm_main(int argc, char **argv); |
22 | int rm_main(int argc, char **argv) | 23 | int rm_main(int argc, char **argv) |
23 | { | 24 | { |
@@ -27,14 +28,15 @@ int rm_main(int argc, char **argv) | |||
27 | 28 | ||
28 | opt_complementary = "f-i:i-f"; | 29 | opt_complementary = "f-i:i-f"; |
29 | opt = getopt32(argc, argv, "fiRr"); | 30 | opt = getopt32(argc, argv, "fiRr"); |
31 | argv += optind; | ||
30 | if(opt & 1) | 32 | if(opt & 1) |
31 | flags |= FILEUTILS_FORCE; | 33 | flags |= FILEUTILS_FORCE; |
32 | if(opt & 2) | 34 | if(opt & 2) |
33 | flags |= FILEUTILS_INTERACTIVE; | 35 | flags |= FILEUTILS_INTERACTIVE; |
34 | if(opt & 12) | 36 | if(opt & 12) |
35 | flags |= FILEUTILS_RECUR; | 37 | flags |= FILEUTILS_RECUR; |
36 | 38 | ||
37 | if (*(argv += optind) != NULL) { | 39 | if (*argv != NULL) { |
38 | do { | 40 | do { |
39 | const char *base = bb_get_last_path_component(*argv); | 41 | const char *base = bb_get_last_path_component(*argv); |
40 | 42 | ||
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c index 8cbd6f1fa..7f3253017 100644 --- a/coreutils/rmdir.c +++ b/coreutils/rmdir.c | |||
@@ -10,11 +10,12 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ |
12 | 12 | ||
13 | #include <stdlib.h> | ||
14 | #include <unistd.h> | ||
15 | #include <libgen.h> | 13 | #include <libgen.h> |
16 | #include "busybox.h" | 14 | #include "busybox.h" |
17 | 15 | ||
16 | /* This is a NOFORK applet. Be very careful! */ | ||
17 | |||
18 | |||
18 | int rmdir_main(int argc, char **argv); | 19 | int rmdir_main(int argc, char **argv); |
19 | int rmdir_main(int argc, char **argv) | 20 | int rmdir_main(int argc, char **argv) |
20 | { | 21 | { |
@@ -24,7 +25,6 @@ int rmdir_main(int argc, char **argv) | |||
24 | char *path; | 25 | char *path; |
25 | 26 | ||
26 | flags = getopt32(argc, argv, "p"); | 27 | flags = getopt32(argc, argv, "p"); |
27 | |||
28 | argv += optind; | 28 | argv += optind; |
29 | 29 | ||
30 | if (!*argv) { | 30 | if (!*argv) { |
@@ -37,7 +37,7 @@ int rmdir_main(int argc, char **argv) | |||
37 | /* Record if the first char was a '.' so we can use dirname later. */ | 37 | /* Record if the first char was a '.' so we can use dirname later. */ |
38 | do_dot = (*path == '.'); | 38 | do_dot = (*path == '.'); |
39 | 39 | ||
40 | do { | 40 | while (1) { |
41 | if (rmdir(path) < 0) { | 41 | if (rmdir(path) < 0) { |
42 | bb_perror_msg("'%s'", path); /* Match gnu rmdir msg. */ | 42 | bb_perror_msg("'%s'", path); /* Match gnu rmdir msg. */ |
43 | status = EXIT_FAILURE; | 43 | status = EXIT_FAILURE; |
@@ -53,7 +53,7 @@ int rmdir_main(int argc, char **argv) | |||
53 | } | 53 | } |
54 | } | 54 | } |
55 | break; | 55 | break; |
56 | } while (1); | 56 | } |
57 | 57 | ||
58 | } while (*++argv); | 58 | } while (*++argv); |
59 | 59 | ||
diff --git a/coreutils/seq.c b/coreutils/seq.c index e81a4660a..ef884d6ae 100644 --- a/coreutils/seq.c +++ b/coreutils/seq.c | |||
@@ -7,21 +7,22 @@ | |||
7 | * Licensed under the GPL v2, see the file LICENSE in this tarball. | 7 | * Licensed under the GPL v2, see the file LICENSE in this tarball. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <stdio.h> | ||
11 | #include <stdlib.h> | ||
12 | #include "busybox.h" | 10 | #include "busybox.h" |
13 | 11 | ||
12 | /* This is a NOFORK applet. Be very careful! */ | ||
13 | |||
14 | |||
14 | int seq_main(int argc, char **argv); | 15 | int seq_main(int argc, char **argv); |
15 | int seq_main(int argc, char **argv) | 16 | int seq_main(int argc, char **argv) |
16 | { | 17 | { |
17 | double last, first, increment, i; | 18 | double last, increment, i; |
18 | 19 | ||
19 | first = increment = 1; | 20 | i = increment = 1; |
20 | switch (argc) { | 21 | switch (argc) { |
21 | case 4: | 22 | case 4: |
22 | increment = atof(argv[2]); | 23 | increment = atof(argv[2]); |
23 | case 3: | 24 | case 3: |
24 | first = atof(argv[1]); | 25 | i = atof(argv[1]); |
25 | case 2: | 26 | case 2: |
26 | last = atof(argv[argc-1]); | 27 | last = atof(argv[argc-1]); |
27 | break; | 28 | break; |
@@ -30,12 +31,10 @@ int seq_main(int argc, char **argv) | |||
30 | } | 31 | } |
31 | 32 | ||
32 | /* You should note that this is pos-5.0.91 semantics, -- FK. */ | 33 | /* You should note that this is pos-5.0.91 semantics, -- FK. */ |
33 | for (i = first; | 34 | while ((increment > 0 && i <= last) || (increment < 0 && i >= last)) { |
34 | (increment > 0 && i <= last) || (increment < 0 && i >=last); | ||
35 | i += increment) | ||
36 | { | ||
37 | printf("%g\n", i); | 35 | printf("%g\n", i); |
36 | i += increment; | ||
38 | } | 37 | } |
39 | 38 | ||
40 | return EXIT_SUCCESS; | 39 | return fflush(stdout); |
41 | } | 40 | } |
diff --git a/coreutils/sleep.c b/coreutils/sleep.c index b89b0fe9c..592005bab 100644 --- a/coreutils/sleep.c +++ b/coreutils/sleep.c | |||
@@ -18,12 +18,12 @@ | |||
18 | * time suffixes for seconds, minutes, hours, and days. | 18 | * time suffixes for seconds, minutes, hours, and days. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <stdlib.h> | ||
22 | #include <limits.h> | ||
23 | #include <unistd.h> | ||
24 | #include "busybox.h" | 21 | #include "busybox.h" |
25 | 22 | ||
26 | #ifdef CONFIG_FEATURE_FANCY_SLEEP | 23 | /* This is a NOFORK applet. Be very careful! */ |
24 | |||
25 | |||
26 | #if ENABLE_FEATURE_FANCY_SLEEP | ||
27 | static const struct suffix_mult sfx[] = { | 27 | static const struct suffix_mult sfx[] = { |
28 | { "s", 1 }, | 28 | { "s", 1 }, |
29 | { "m", 60 }, | 29 | { "m", 60 }, |
@@ -36,9 +36,9 @@ static const struct suffix_mult sfx[] = { | |||
36 | int sleep_main(int argc, char **argv); | 36 | int sleep_main(int argc, char **argv); |
37 | int sleep_main(int argc, char **argv) | 37 | int sleep_main(int argc, char **argv) |
38 | { | 38 | { |
39 | unsigned int duration; | 39 | unsigned duration; |
40 | 40 | ||
41 | #ifdef CONFIG_FEATURE_FANCY_SLEEP | 41 | #if ENABLE_FEATURE_FANCY_SLEEP |
42 | 42 | ||
43 | if (argc < 2) { | 43 | if (argc < 2) { |
44 | bb_show_usage(); | 44 | bb_show_usage(); |
@@ -50,7 +50,7 @@ int sleep_main(int argc, char **argv) | |||
50 | duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx); | 50 | duration += xatoul_range_sfx(*argv, 0, UINT_MAX-duration, sfx); |
51 | } while (*++argv); | 51 | } while (*++argv); |
52 | 52 | ||
53 | #else /* CONFIG_FEATURE_FANCY_SLEEP */ | 53 | #else /* FEATURE_FANCY_SLEEP */ |
54 | 54 | ||
55 | if (argc != 2) { | 55 | if (argc != 2) { |
56 | bb_show_usage(); | 56 | bb_show_usage(); |
@@ -58,7 +58,7 @@ int sleep_main(int argc, char **argv) | |||
58 | 58 | ||
59 | duration = xatou(argv[1]); | 59 | duration = xatou(argv[1]); |
60 | 60 | ||
61 | #endif /* CONFIG_FEATURE_FANCY_SLEEP */ | 61 | #endif /* FEATURE_FANCY_SLEEP */ |
62 | 62 | ||
63 | if (sleep(duration)) { | 63 | if (sleep(duration)) { |
64 | bb_perror_nomsg_and_die(); | 64 | bb_perror_nomsg_and_die(); |
diff --git a/coreutils/sort.c b/coreutils/sort.c index dad542964..06a6cbf70 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c | |||
@@ -14,6 +14,9 @@ | |||
14 | 14 | ||
15 | #include "busybox.h" | 15 | #include "busybox.h" |
16 | 16 | ||
17 | /* This is a NOEXEC applet. Be very careful! */ | ||
18 | |||
19 | |||
17 | /* | 20 | /* |
18 | sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...] | 21 | sort [-m][-o output][-bdfinru][-t char][-k keydef]... [file...] |
19 | sort -c [-bdfinru][-t char][-k keydef][file] | 22 | sort -c [-bdfinru][-t char][-k keydef][file] |
diff --git a/coreutils/sync.c b/coreutils/sync.c index 536c57a17..e52ab768d 100644 --- a/coreutils/sync.c +++ b/coreutils/sync.c | |||
@@ -9,10 +9,10 @@ | |||
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ | 10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ |
11 | 11 | ||
12 | #include <stdlib.h> | ||
13 | #include <unistd.h> | ||
14 | #include "busybox.h" | 12 | #include "busybox.h" |
15 | 13 | ||
14 | /* This is a NOFORK applet. Be very careful! */ | ||
15 | |||
16 | int sync_main(int argc, char **argv); | 16 | int sync_main(int argc, char **argv); |
17 | int sync_main(int argc, char **argv) | 17 | int sync_main(int argc, char **argv) |
18 | { | 18 | { |
diff --git a/coreutils/test.c b/coreutils/test.c index d5babefce..e9b627638 100644 --- a/coreutils/test.c +++ b/coreutils/test.c | |||
@@ -21,12 +21,11 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include "busybox.h" | 23 | #include "busybox.h" |
24 | #include <unistd.h> | ||
25 | #include <ctype.h> | ||
26 | #include <errno.h> | ||
27 | #include <string.h> | ||
28 | #include <setjmp.h> | 24 | #include <setjmp.h> |
29 | 25 | ||
26 | /* This is a NOEXEC applet. Be very careful! */ | ||
27 | |||
28 | |||
30 | /* test(1) accepts the following grammar: | 29 | /* test(1) accepts the following grammar: |
31 | oexpr ::= aexpr | aexpr "-o" oexpr ; | 30 | oexpr ::= aexpr | aexpr "-o" oexpr ; |
32 | aexpr ::= nexpr | nexpr "-a" aexpr ; | 31 | aexpr ::= nexpr | nexpr "-a" aexpr ; |
diff --git a/coreutils/true.c b/coreutils/true.c index b2f3a9bad..eee621331 100644 --- a/coreutils/true.c +++ b/coreutils/true.c | |||
@@ -10,9 +10,10 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ |
12 | 12 | ||
13 | #include <stdlib.h> | ||
14 | #include "busybox.h" | 13 | #include "busybox.h" |
15 | 14 | ||
15 | /* This is a NOFORK applet. Be very careful! */ | ||
16 | |||
16 | int true_main(int argc, char **argv); | 17 | int true_main(int argc, char **argv); |
17 | int true_main(int argc, char **argv) | 18 | int true_main(int argc, char **argv) |
18 | { | 19 | { |
diff --git a/coreutils/tty.c b/coreutils/tty.c index c28aa33d7..d4c179fca 100644 --- a/coreutils/tty.c +++ b/coreutils/tty.c | |||
@@ -10,9 +10,6 @@ | |||
10 | /* BB_AUDIT SUSv3 compliant */ | 10 | /* BB_AUDIT SUSv3 compliant */ |
11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/tty.html */ | 11 | /* http://www.opengroup.org/onlinepubs/007904975/utilities/tty.html */ |
12 | 12 | ||
13 | #include <stdio.h> | ||
14 | #include <stdlib.h> | ||
15 | #include <unistd.h> | ||
16 | #include "busybox.h" | 13 | #include "busybox.h" |
17 | 14 | ||
18 | int tty_main(int argc, char **argv); | 15 | int tty_main(int argc, char **argv); |
@@ -31,7 +28,8 @@ int tty_main(int argc, char **argv) | |||
31 | 28 | ||
32 | retval = 0; | 29 | retval = 0; |
33 | 30 | ||
34 | if ((s = ttyname(0)) == NULL) { | 31 | s = ttyname(0); |
32 | if (s == NULL) { | ||
35 | /* According to SUSv3, ttyname can on fail with EBADF or ENOTTY. | 33 | /* According to SUSv3, ttyname can on fail with EBADF or ENOTTY. |
36 | * We know the file descriptor is good, so failure means not a tty. */ | 34 | * We know the file descriptor is good, so failure means not a tty. */ |
37 | s = "not a tty"; | 35 | s = "not a tty"; |
diff --git a/coreutils/usleep.c b/coreutils/usleep.c index 7dd914638..2baf2bc87 100644 --- a/coreutils/usleep.c +++ b/coreutils/usleep.c | |||
@@ -9,11 +9,10 @@ | |||
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ | 10 | /* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ |
11 | 11 | ||
12 | #include <stdlib.h> | ||
13 | #include <limits.h> | ||
14 | #include <unistd.h> | ||
15 | #include "busybox.h" | 12 | #include "busybox.h" |
16 | 13 | ||
14 | /* This is a NOFORK applet. Be very careful! */ | ||
15 | |||
17 | int usleep_main(int argc, char **argv); | 16 | int usleep_main(int argc, char **argv); |
18 | int usleep_main(int argc, char **argv) | 17 | int usleep_main(int argc, char **argv) |
19 | { | 18 | { |
diff --git a/coreutils/whoami.c b/coreutils/whoami.c index 3185817b6..25757f633 100644 --- a/coreutils/whoami.c +++ b/coreutils/whoami.c | |||
@@ -9,11 +9,10 @@ | |||
9 | 9 | ||
10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ | 10 | /* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ |
11 | 11 | ||
12 | #include <stdio.h> | ||
13 | #include <stdlib.h> | ||
14 | #include <unistd.h> | ||
15 | #include "busybox.h" | 12 | #include "busybox.h" |
16 | 13 | ||
14 | /* This is a NOFORK applet. Be very careful! */ | ||
15 | |||
17 | int whoami_main(int argc, char **argv); | 16 | int whoami_main(int argc, char **argv); |
18 | int whoami_main(int argc, char **argv) | 17 | int whoami_main(int argc, char **argv) |
19 | { | 18 | { |
@@ -21,6 +20,6 @@ int whoami_main(int argc, char **argv) | |||
21 | bb_show_usage(); | 20 | bb_show_usage(); |
22 | 21 | ||
23 | puts(bb_getpwuid(NULL, geteuid(), -1)); | 22 | puts(bb_getpwuid(NULL, geteuid(), -1)); |
24 | /* exits on error */ | 23 | |
25 | fflush_stdout_and_exit(EXIT_SUCCESS); | 24 | return fflush(stdout); |
26 | } | 25 | } |
diff --git a/coreutils/yes.c b/coreutils/yes.c index 2611c3e82..569764150 100644 --- a/coreutils/yes.c +++ b/coreutils/yes.c | |||
@@ -16,25 +16,26 @@ | |||
16 | 16 | ||
17 | #include "busybox.h" | 17 | #include "busybox.h" |
18 | 18 | ||
19 | /* This is a NOFORK applet. Be very careful! */ | ||
20 | |||
19 | int yes_main(int argc, char **argv); | 21 | int yes_main(int argc, char **argv); |
20 | int yes_main(int argc, char **argv) | 22 | int yes_main(int argc, char **argv) |
21 | { | 23 | { |
22 | static const char fmt_str[] = " %s"; | ||
23 | const char *fmt; | ||
24 | char **first_arg; | 24 | char **first_arg; |
25 | 25 | ||
26 | *argv = (char*)"y"; | 26 | argv[0] = (char*)"y"; |
27 | if (argc != 1) { | 27 | if (argc != 1) { |
28 | ++argv; | 28 | ++argv; |
29 | } | 29 | } |
30 | 30 | ||
31 | first_arg = argv; | 31 | first_arg = argv; |
32 | do { | 32 | do { |
33 | fmt = fmt_str + 1; | 33 | while (1) { |
34 | do { | 34 | fputs(*argv, stdout); |
35 | printf(fmt, *argv); | 35 | if (!*++argv) |
36 | fmt = fmt_str; | 36 | break; |
37 | } while (*++argv); | 37 | putchar(' '); |
38 | } | ||
38 | argv = first_arg; | 39 | argv = first_arg; |
39 | } while (putchar('\n') != EOF); | 40 | } while (putchar('\n') != EOF); |
40 | 41 | ||
diff --git a/editors/awk.c b/editors/awk.c index f331a33fa..1bdb9b924 100644 --- a/editors/awk.c +++ b/editors/awk.c | |||
@@ -11,6 +11,8 @@ | |||
11 | #include "xregex.h" | 11 | #include "xregex.h" |
12 | #include <math.h> | 12 | #include <math.h> |
13 | 13 | ||
14 | /* This is a NOEXEC applet. Be very careful! */ | ||
15 | |||
14 | 16 | ||
15 | #define MAXVARFMT 240 | 17 | #define MAXVARFMT 240 |
16 | #define MINNVBLOCK 64 | 18 | #define MINNVBLOCK 64 |
diff --git a/findutils/find.c b/findutils/find.c index 1a1301b38..b77d36dc3 100644 --- a/findutils/find.c +++ b/findutils/find.c | |||
@@ -48,6 +48,9 @@ | |||
48 | #include <fnmatch.h> | 48 | #include <fnmatch.h> |
49 | #include "busybox.h" | 49 | #include "busybox.h" |
50 | 50 | ||
51 | /* This is a NOEXEC applet. Be very careful! */ | ||
52 | |||
53 | |||
51 | USE_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) | 54 | USE_FEATURE_FIND_XDEV(static dev_t *xdev_dev;) |
52 | USE_FEATURE_FIND_XDEV(static int xdev_count;) | 55 | USE_FEATURE_FIND_XDEV(static int xdev_count;) |
53 | 56 | ||
diff --git a/findutils/xargs.c b/findutils/xargs.c index b4dd9f876..2b3a5081c 100644 --- a/findutils/xargs.c +++ b/findutils/xargs.c | |||
@@ -19,6 +19,9 @@ | |||
19 | 19 | ||
20 | #include "busybox.h" | 20 | #include "busybox.h" |
21 | 21 | ||
22 | /* This is a NOEXEC applet. Be very careful! */ | ||
23 | |||
24 | |||
22 | /* COMPAT: SYSV version defaults size (and has a max value of) to 470. | 25 | /* COMPAT: SYSV version defaults size (and has a max value of) to 470. |
23 | We try to make it as large as possible. */ | 26 | We try to make it as large as possible. */ |
24 | #if !defined(ARG_MAX) && defined(_SC_ARG_MAX) | 27 | #if !defined(ARG_MAX) && defined(_SC_ARG_MAX) |
diff --git a/include/applets.h b/include/applets.h index ecce32169..b59d33183 100644 --- a/include/applets.h +++ b/include/applets.h | |||
@@ -76,17 +76,17 @@ USE_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_NEVER)) | |||
76 | USE_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 76 | USE_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
77 | USE_ASH(APPLET_NOUSAGE(ash, ash, _BB_DIR_BIN, _BB_SUID_NEVER)) | 77 | USE_ASH(APPLET_NOUSAGE(ash, ash, _BB_DIR_BIN, _BB_SUID_NEVER)) |
78 | USE_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk)) | 78 | USE_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk)) |
79 | USE_BASENAME(APPLET(basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 79 | USE_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename)) |
80 | USE_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER)) | 80 | USE_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER)) |
81 | //USE_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER)) | 81 | //USE_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER)) |
82 | USE_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 82 | USE_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
83 | USE_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER, bzcat)) | 83 | USE_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER, bzcat)) |
84 | USE_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 84 | USE_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
85 | USE_CAT(APPLET_NOEXEC(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat)) | 85 | USE_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat)) |
86 | USE_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER)) | 86 | USE_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER)) |
87 | USE_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER)) | 87 | USE_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER)) |
88 | USE_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 88 | USE_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
89 | USE_CHGRP(APPLET(chgrp, _BB_DIR_BIN, _BB_SUID_NEVER)) | 89 | USE_CHGRP(APPLET_NOEXEC(chgrp, chgrp, _BB_DIR_BIN, _BB_SUID_NEVER, chgrp)) |
90 | USE_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod)) | 90 | USE_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod)) |
91 | USE_CHOWN(APPLET_NOEXEC(chown, chown, _BB_DIR_BIN, _BB_SUID_NEVER, chown)) | 91 | USE_CHOWN(APPLET_NOEXEC(chown, chown, _BB_DIR_BIN, _BB_SUID_NEVER, chown)) |
92 | USE_CHPST(APPLET(chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 92 | USE_CHPST(APPLET(chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -112,7 +112,7 @@ USE_DEVFSD(APPLET(devfsd, _BB_DIR_SBIN, _BB_SUID_NEVER)) | |||
112 | USE_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER)) | 112 | USE_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER)) |
113 | USE_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 113 | USE_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
114 | USE_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 114 | USE_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
115 | USE_DIRNAME(APPLET(dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 115 | USE_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname)) |
116 | USE_DMESG(APPLET(dmesg, _BB_DIR_BIN, _BB_SUID_NEVER)) | 116 | USE_DMESG(APPLET(dmesg, _BB_DIR_BIN, _BB_SUID_NEVER)) |
117 | USE_DNSD(APPLET(dnsd, _BB_DIR_USR_SBIN, _BB_SUID_ALWAYS)) | 117 | USE_DNSD(APPLET(dnsd, _BB_DIR_USR_SBIN, _BB_SUID_ALWAYS)) |
118 | USE_DOS2UNIX(APPLET(dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 118 | USE_DOS2UNIX(APPLET(dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -133,7 +133,7 @@ USE_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, | |||
133 | USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake)) | 133 | USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake)) |
134 | USE_EXPR(APPLET(expr, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 134 | USE_EXPR(APPLET(expr, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
135 | USE_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 135 | USE_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
136 | USE_FALSE(APPLET(false, _BB_DIR_BIN, _BB_SUID_NEVER)) | 136 | USE_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false)) |
137 | USE_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 137 | USE_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
138 | USE_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush)) | 138 | USE_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush)) |
139 | USE_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 139 | USE_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -162,7 +162,7 @@ USE_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_NEVER)) | |||
162 | USE_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 162 | USE_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
163 | USE_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 163 | USE_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
164 | USE_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump)) | 164 | USE_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump)) |
165 | USE_HOSTID(APPLET(hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 165 | USE_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hostid)) |
166 | USE_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_NEVER)) | 166 | USE_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_NEVER)) |
167 | USE_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 167 | USE_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
168 | USE_HUSH(APPLET_NOUSAGE(hush, hush, _BB_DIR_BIN, _BB_SUID_NEVER)) | 168 | USE_HUSH(APPLET_NOUSAGE(hush, hush, _BB_DIR_BIN, _BB_SUID_NEVER)) |
@@ -190,7 +190,7 @@ USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, kil | |||
190 | USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 190 | USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
191 | USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER)) | 191 | USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER)) |
192 | USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 192 | USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
193 | USE_LENGTH(APPLET(length, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 193 | USE_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_NEVER, length)) |
194 | USE_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 194 | USE_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
195 | USE_SETARCH(APPLET_NOUSAGE(linux32, setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) | 195 | USE_SETARCH(APPLET_NOUSAGE(linux32, setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) |
196 | USE_SETARCH(APPLET_NOUSAGE(linux64, setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) | 196 | USE_SETARCH(APPLET_NOUSAGE(linux64, setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) |
@@ -201,7 +201,7 @@ USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
201 | USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 201 | USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
202 | USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 202 | USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
203 | USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS)) | 203 | USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS)) |
204 | USE_LOGNAME(APPLET(logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 204 | USE_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname)) |
205 | USE_LOGREAD(APPLET(logread, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 205 | USE_LOGREAD(APPLET(logread, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
206 | USE_LOSETUP(APPLET(losetup, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 206 | USE_LOSETUP(APPLET(losetup, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
207 | USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls)) | 207 | USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls)) |
@@ -213,7 +213,7 @@ USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER)) | |||
213 | USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum)) | 213 | USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum)) |
214 | USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 214 | USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
215 | USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 215 | USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
216 | USE_MKDIR(APPLET_NOEXEC(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir)) | 216 | USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir)) |
217 | //USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 217 | //USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
218 | USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 218 | USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
219 | //USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 219 | //USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
@@ -249,7 +249,7 @@ USE_HALT(APPLET_ODDNAME(poweroff, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, poweroff)) | |||
249 | USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER)) | 249 | USE_PRINTENV(APPLET(printenv, _BB_DIR_BIN, _BB_SUID_NEVER)) |
250 | USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 250 | USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
251 | USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER)) | 251 | USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER)) |
252 | USE_PWD(APPLET(pwd, _BB_DIR_BIN, _BB_SUID_NEVER)) | 252 | USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd)) |
253 | USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 253 | USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
254 | USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 254 | USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
255 | USE_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 255 | USE_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -260,8 +260,8 @@ USE_HALT(APPLET_ODDNAME(reboot, halt, _BB_DIR_SBIN, _BB_SUID_NEVER, reboot)) | |||
260 | USE_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 260 | USE_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
261 | USE_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 261 | USE_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
262 | USE_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 262 | USE_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
263 | USE_RM(APPLET_NOEXEC(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm)) | 263 | USE_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm)) |
264 | USE_RMDIR(APPLET(rmdir, _BB_DIR_BIN, _BB_SUID_NEVER)) | 264 | USE_RMDIR(APPLET_NOFORK(rmdir, rmdir, _BB_DIR_BIN, _BB_SUID_NEVER, rmdir)) |
265 | USE_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 265 | USE_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
266 | USE_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 266 | USE_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
267 | USE_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER)) | 267 | USE_RPM(APPLET(rpm, _BB_DIR_BIN, _BB_SUID_NEVER)) |
@@ -274,7 +274,7 @@ USE_RUNSVDIR(APPLET(runsvdir, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
274 | USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 274 | USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
275 | USE_SELINUXENABLED(APPLET(selinuxenabled, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 275 | USE_SELINUXENABLED(APPLET(selinuxenabled, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
276 | USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER)) | 276 | USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER)) |
277 | USE_SEQ(APPLET(seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 277 | USE_SEQ(APPLET_NOFORK(seq, seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER, seq)) |
278 | USE_SETARCH(APPLET(setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) | 278 | USE_SETARCH(APPLET(setarch, _BB_DIR_BIN, _BB_SUID_NEVER)) |
279 | USE_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 279 | USE_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
280 | USE_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) | 280 | USE_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER)) |
@@ -287,7 +287,7 @@ USE_FEATURE_SH_IS_HUSH(APPLET_NOUSAGE(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER)) | |||
287 | USE_FEATURE_SH_IS_LASH(APPLET_NOUSAGE(sh, lash, _BB_DIR_BIN, _BB_SUID_NEVER)) | 287 | USE_FEATURE_SH_IS_LASH(APPLET_NOUSAGE(sh, lash, _BB_DIR_BIN, _BB_SUID_NEVER)) |
288 | USE_FEATURE_SH_IS_MSH(APPLET_NOUSAGE(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER)) | 288 | USE_FEATURE_SH_IS_MSH(APPLET_NOUSAGE(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER)) |
289 | USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum)) | 289 | USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum)) |
290 | USE_SLEEP(APPLET(sleep, _BB_DIR_BIN, _BB_SUID_NEVER)) | 290 | USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep)) |
291 | USE_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, softlimit)) | 291 | USE_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, softlimit)) |
292 | USE_SORT(APPLET_NOEXEC(sort, sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sort)) | 292 | USE_SORT(APPLET_NOEXEC(sort, sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sort)) |
293 | USE_SPLIT(APPLET(split, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 293 | USE_SPLIT(APPLET(split, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -303,7 +303,7 @@ USE_SVLOGD(APPLET(svlogd, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
303 | USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff)) | 303 | USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff)) |
304 | USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon)) | 304 | USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon)) |
305 | USE_SWITCH_ROOT(APPLET(switch_root, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 305 | USE_SWITCH_ROOT(APPLET(switch_root, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
306 | USE_SYNC(APPLET(sync, _BB_DIR_BIN, _BB_SUID_NEVER)) | 306 | USE_SYNC(APPLET_NOFORK(sync, sync, _BB_DIR_BIN, _BB_SUID_NEVER, sync)) |
307 | USE_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 307 | USE_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
308 | USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 308 | USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
309 | USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 309 | USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
@@ -322,7 +322,7 @@ USE_TOP(APPLET(top, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
322 | USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch)) | 322 | USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch)) |
323 | USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 323 | USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
324 | USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE)) | 324 | USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE)) |
325 | USE_TRUE(APPLET(true, _BB_DIR_BIN, _BB_SUID_NEVER)) | 325 | USE_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true)) |
326 | USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 326 | USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
327 | //USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 327 | //USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
328 | USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 328 | USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
@@ -336,7 +336,7 @@ USE_UNIX2DOS(APPLET_ODDNAME(unix2dos, dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER, | |||
336 | USE_UNLZMA(APPLET(unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 336 | USE_UNLZMA(APPLET(unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
337 | USE_UNZIP(APPLET(unzip, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 337 | USE_UNZIP(APPLET(unzip, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
338 | USE_UPTIME(APPLET(uptime, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 338 | USE_UPTIME(APPLET(uptime, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
339 | USE_USLEEP(APPLET(usleep, _BB_DIR_BIN, _BB_SUID_NEVER)) | 339 | USE_USLEEP(APPLET_NOFORK(usleep, usleep, _BB_DIR_BIN, _BB_SUID_NEVER, usleep)) |
340 | USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 340 | USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
341 | USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 341 | USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
342 | USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 342 | USE_VCONFIG(APPLET(vconfig, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
@@ -348,9 +348,9 @@ USE_WC(APPLET(wc, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | |||
348 | USE_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 348 | USE_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
349 | USE_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 349 | USE_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
350 | USE_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 350 | USE_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) |
351 | USE_WHOAMI(APPLET(whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 351 | USE_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER, whoami)) |
352 | USE_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER, xargs)) | 352 | USE_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER, xargs)) |
353 | USE_YES(APPLET(yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER)) | 353 | USE_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes)) |
354 | USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat)) | 354 | USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat)) |
355 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) | 355 | USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER)) |
356 | 356 | ||
diff --git a/libbb/copyfd.c b/libbb/copyfd.c index 805b80187..e0596d5f6 100644 --- a/libbb/copyfd.c +++ b/libbb/copyfd.c | |||
@@ -7,19 +7,15 @@ | |||
7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. | 7 | * Licensed under GPLv2 or later, see file LICENSE in this tarball for details. |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #include <errno.h> | ||
11 | #include <stdlib.h> | ||
12 | #include <string.h> | ||
13 | #include <unistd.h> | ||
14 | |||
15 | #include "libbb.h" | 10 | #include "libbb.h" |
16 | 11 | ||
17 | |||
18 | #if BUFSIZ < 4096 | 12 | #if BUFSIZ < 4096 |
19 | #undef BUFSIZ | 13 | #undef BUFSIZ |
20 | #define BUFSIZ 4096 | 14 | #define BUFSIZ 4096 |
21 | #endif | 15 | #endif |
22 | 16 | ||
17 | /* Used by NOFORK applets (e.g. cat) - must be very careful | ||
18 | * when calling xfuncs, allocating memory, with signals, termios, etc... */ | ||
23 | 19 | ||
24 | static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size) | 20 | static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size) |
25 | { | 21 | { |
@@ -27,7 +23,8 @@ static off_t bb_full_fd_action(int src_fd, int dst_fd, off_t size) | |||
27 | off_t total = 0; | 23 | off_t total = 0; |
28 | RESERVE_CONFIG_BUFFER(buffer, BUFSIZ); | 24 | RESERVE_CONFIG_BUFFER(buffer, BUFSIZ); |
29 | 25 | ||
30 | if (src_fd < 0) goto out; | 26 | if (src_fd < 0) |
27 | goto out; | ||
31 | 28 | ||
32 | if (!size) { | 29 | if (!size) { |
33 | size = BUFSIZ; | 30 | size = BUFSIZ; |
diff --git a/libbb/fflush_stdout_and_exit.c b/libbb/fflush_stdout_and_exit.c index 6f44770c6..ae68222b4 100644 --- a/libbb/fflush_stdout_and_exit.c +++ b/libbb/fflush_stdout_and_exit.c | |||
@@ -13,6 +13,10 @@ | |||
13 | 13 | ||
14 | #include "libbb.h" | 14 | #include "libbb.h" |
15 | 15 | ||
16 | // TODO: make it safe to call from NOFORK applets | ||
17 | // Currently, it can exit(0). Even if it is made to do longjmp trick | ||
18 | // (see sleep_and_die internals), zero cannot be passed thru this way! | ||
19 | |||
16 | void fflush_stdout_and_exit(int retval) | 20 | void fflush_stdout_and_exit(int retval) |
17 | { | 21 | { |
18 | if (fflush(stdout)) | 22 | if (fflush(stdout)) |
diff --git a/libbb/make_directory.c b/libbb/make_directory.c index fbec4e20e..d540ad133 100644 --- a/libbb/make_directory.c +++ b/libbb/make_directory.c | |||
@@ -22,11 +22,10 @@ | |||
22 | * val. Otherwise, pass -1 to get default permissions. | 22 | * val. Otherwise, pass -1 to get default permissions. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <errno.h> | ||
26 | #include <unistd.h> | ||
27 | #include <sys/stat.h> | ||
28 | #include "libbb.h" | 25 | #include "libbb.h" |
29 | 26 | ||
27 | /* This function is used from NOFORK applets. It must not allocate anything */ | ||
28 | |||
30 | int bb_make_directory (char *path, long mode, int flags) | 29 | int bb_make_directory (char *path, long mode, int flags) |
31 | { | 30 | { |
32 | mode_t mask; | 31 | mode_t mask; |
diff --git a/libbb/parse_mode.c b/libbb/parse_mode.c index 3ab4eb6fc..a31bd4bfd 100644 --- a/libbb/parse_mode.c +++ b/libbb/parse_mode.c | |||
@@ -11,6 +11,8 @@ | |||
11 | 11 | ||
12 | #include "libbb.h" | 12 | #include "libbb.h" |
13 | 13 | ||
14 | /* This function is used from NOFORK applets. It must not allocate anything */ | ||
15 | |||
14 | #define FILEMODEBITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) | 16 | #define FILEMODEBITS (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) |
15 | 17 | ||
16 | int bb_parse_mode(const char *s, mode_t *current_mode) | 18 | int bb_parse_mode(const char *s, mode_t *current_mode) |
diff --git a/libbb/remove_file.c b/libbb/remove_file.c index 3aaaef8c7..3edc91dae 100644 --- a/libbb/remove_file.c +++ b/libbb/remove_file.c | |||
@@ -9,6 +9,8 @@ | |||
9 | 9 | ||
10 | #include "libbb.h" | 10 | #include "libbb.h" |
11 | 11 | ||
12 | /* Used from NOFORK applets. Must not allocate anything */ | ||
13 | |||
12 | int remove_file(const char *path, int flags) | 14 | int remove_file(const char *path, int flags) |
13 | { | 15 | { |
14 | struct stat path_stat; | 16 | struct stat path_stat; |
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index cddd185e2..85a449038 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c | |||
@@ -9,10 +9,13 @@ | |||
9 | * Licensed under GPLv2 or later, see file License in this tarball for details. | 9 | * Licensed under GPLv2 or later, see file License in this tarball for details. |
10 | */ | 10 | */ |
11 | 11 | ||
12 | #include "busybox.h" | ||
13 | #include <getopt.h> | 12 | #include <getopt.h> |
13 | #include "busybox.h" | ||
14 | #include "dump.h" | 14 | #include "dump.h" |
15 | 15 | ||
16 | /* This is a NOEXEC applet. Be very careful! */ | ||
17 | |||
18 | |||
16 | static void bb_dump_addfile(char *name) | 19 | static void bb_dump_addfile(char *name) |
17 | { | 20 | { |
18 | char *p; | 21 | char *p; |
@@ -45,10 +48,10 @@ static const char add_first[] = "\"%07.7_Ax\n\""; | |||
45 | static const char hexdump_opts[] = "bcdoxCe:f:n:s:v"; | 48 | static const char hexdump_opts[] = "bcdoxCe:f:n:s:v"; |
46 | 49 | ||
47 | static const struct suffix_mult suffixes[] = { | 50 | static const struct suffix_mult suffixes[] = { |
48 | {"b", 512 }, | 51 | { "b", 512 }, |
49 | {"k", 1024 }, | 52 | { "k", 1024 }, |
50 | {"m", 1024*1024 }, | 53 | { "m", 1024*1024 }, |
51 | {NULL, 0 } | 54 | { NULL, 0 } |
52 | }; | 55 | }; |
53 | 56 | ||
54 | int hexdump_main(int argc, char **argv); | 57 | int hexdump_main(int argc, char **argv); |