aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2017-12-31 17:30:02 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2017-12-31 17:30:02 +0100
commit82d1c1f84ae23793d81b50aa0a753ad7c4db4f51 (patch)
treee5c1dc00b04299cf627cf2ef18453aea96c5f1e5
parent36acc4631c94bb0f43ecaac5d61dc773ef773e91 (diff)
downloadbusybox-w32-82d1c1f84ae23793d81b50aa0a753ad7c4db4f51.tar.gz
busybox-w32-82d1c1f84ae23793d81b50aa0a753ad7c4db4f51.tar.bz2
busybox-w32-82d1c1f84ae23793d81b50aa0a753ad7c4db4f51.zip
randomconfig fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/cat.c5
-rw-r--r--coreutils/ls.c5
-rw-r--r--coreutils/stat.c7
-rw-r--r--coreutils/uname.c6
-rw-r--r--libbb/Kbuild.src1
-rw-r--r--libbb/lineedit.c3
-rw-r--r--loginutils/addgroup.c7
-rwxr-xr-xmake_single_applets.sh3
-rw-r--r--networking/tftp.c3
-rw-r--r--procps/kill.c7
-rwxr-xr-xscripts/randomtest.loop1
-rw-r--r--shell/ash.c2
-rw-r--r--shell/hush.c13
13 files changed, 42 insertions, 21 deletions
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 7e35fa5ee..5f02233ca 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -168,9 +168,12 @@ static int catv(unsigned opts, char **argv)
168int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 168int cat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
169int cat_main(int argc UNUSED_PARAM, char **argv) 169int cat_main(int argc UNUSED_PARAM, char **argv)
170{ 170{
171#if ENABLE_FEATURE_CATV || ENABLE_FEATURE_CATN
171 unsigned opts; 172 unsigned opts;
172 173
173 opts = getopt32(argv, IF_FEATURE_CATV("^") 174 opts =
175#endif
176 getopt32(argv, IF_FEATURE_CATV("^")
174 /* -u is ignored ("unbuffered") */ 177 /* -u is ignored ("unbuffered") */
175 IF_FEATURE_CATV("etvA")IF_FEATURE_CATN("nb")"u" 178 IF_FEATURE_CATV("etvA")IF_FEATURE_CATN("nb")"u"
176 IF_FEATURE_CATV("\0" "Aetv" /* -A == -vet */) 179 IF_FEATURE_CATV("\0" "Aetv" /* -A == -vet */)
diff --git a/coreutils/ls.c b/coreutils/ls.c
index a4e324b00..4be499088 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -482,12 +482,11 @@ static NOINLINE unsigned display_single(const struct dnode *dn)
482 int opt; 482 int opt;
483#if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR 483#if ENABLE_FEATURE_LS_FILETYPES || ENABLE_FEATURE_LS_COLOR
484 struct stat statbuf; 484 struct stat statbuf;
485 char append;
486#endif 485#endif
487
488#if ENABLE_FEATURE_LS_FILETYPES 486#if ENABLE_FEATURE_LS_FILETYPES
489 append = append_char(dn->dn_mode); 487 char append = append_char(dn->dn_mode);
490#endif 488#endif
489
491 opt = option_mask32; 490 opt = option_mask32;
492 491
493 /* Do readlink early, so that if it fails, error message 492 /* Do readlink early, so that if it fails, error message
diff --git a/coreutils/stat.c b/coreutils/stat.c
index dafbd4e9f..7ba3db155 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -759,10 +759,13 @@ int stat_main(int argc UNUSED_PARAM, char **argv)
759 IF_FEATURE_STAT_FORMAT(char *format = NULL;) 759 IF_FEATURE_STAT_FORMAT(char *format = NULL;)
760 int i; 760 int i;
761 int ok; 761 int ok;
762 unsigned opts;
763 statfunc_ptr statfunc = do_stat; 762 statfunc_ptr statfunc = do_stat;
763#if ENABLE_FEATURE_STAT_FILESYSTEM || ENABLE_SELINUX
764 unsigned opts;
764 765
765 opts = getopt32(argv, "^" 766 opts =
767#endif
768 getopt32(argv, "^"
766 "tL" 769 "tL"
767 IF_FEATURE_STAT_FILESYSTEM("f") 770 IF_FEATURE_STAT_FILESYSTEM("f")
768 IF_SELINUX("Z") 771 IF_SELINUX("Z")
diff --git a/coreutils/uname.c b/coreutils/uname.c
index 57039b1bf..765809658 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -127,11 +127,9 @@ int uname_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
127{ 127{
128 uname_info_t uname_info; 128 uname_info_t uname_info;
129 IF_UNAME(const char *unknown_str = "unknown";) 129 IF_UNAME(const char *unknown_str = "unknown";)
130 unsigned toprint;
131
132 toprint = (1 << 4); /* "arch" = "uname -m" */
133
134#if ENABLE_UNAME 130#if ENABLE_UNAME
131 unsigned toprint = (1 << 4); /* "arch" = "uname -m" */
132
135 if (!ENABLE_BB_ARCH || applet_name[0] == 'u') { 133 if (!ENABLE_BB_ARCH || applet_name[0] == 'u') {
136# if ENABLE_LONG_OPTS 134# if ENABLE_LONG_OPTS
137 static const char uname_longopts[] ALIGN1 = 135 static const char uname_longopts[] ALIGN1 =
diff --git a/libbb/Kbuild.src b/libbb/Kbuild.src
index 73201a6bd..6e6d71ad5 100644
--- a/libbb/Kbuild.src
+++ b/libbb/Kbuild.src
@@ -124,6 +124,7 @@ lib-$(CONFIG_UNICODE_SUPPORT) += unicode.o
124lib-$(CONFIG_FEATURE_CHECK_NAMES) += die_if_bad_username.o 124lib-$(CONFIG_FEATURE_CHECK_NAMES) += die_if_bad_username.o
125 125
126lib-$(CONFIG_NC) += udp_io.o 126lib-$(CONFIG_NC) += udp_io.o
127lib-$(CONFIG_NETCAT) += udp_io.o
127lib-$(CONFIG_DNSD) += udp_io.o 128lib-$(CONFIG_DNSD) += udp_io.o
128lib-$(CONFIG_NTPD) += udp_io.o 129lib-$(CONFIG_NTPD) += udp_io.o
129lib-$(CONFIG_TFTP) += udp_io.o 130lib-$(CONFIG_TFTP) += udp_io.o
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 5624a7fc3..896bbc88c 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -90,7 +90,8 @@ static bool BB_ispunct(CHAR_T c) { return ((unsigned)c < 256 && ispunct(c)); }
90# define CHAR_T char 90# define CHAR_T char
91# define BB_isspace(c) isspace(c) 91# define BB_isspace(c) isspace(c)
92# if ENABLE_FEATURE_EDITING_VI 92# if ENABLE_FEATURE_EDITING_VI
93static bool BB_isalnum_or_underscore(CHAR_T c) { 93static bool BB_isalnum_or_underscore(CHAR_T c)
94{
94 return ((unsigned)c < 256 && isalnum(c)) || c == '_'; 95 return ((unsigned)c < 256 && isalnum(c)) || c == '_';
95} 96}
96# endif 97# endif
diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c
index ec11b30ca..6839eafbd 100644
--- a/loginutils/addgroup.c
+++ b/loginutils/addgroup.c
@@ -142,7 +142,9 @@ static const char addgroup_longopts[] ALIGN1 =
142int addgroup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 142int addgroup_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
143int addgroup_main(int argc UNUSED_PARAM, char **argv) 143int addgroup_main(int argc UNUSED_PARAM, char **argv)
144{ 144{
145#if ENABLE_FEATURE_ADDUSER_TO_GROUP
145 unsigned opts; 146 unsigned opts;
147#endif
146 const char *gid = "0"; 148 const char *gid = "0";
147 149
148 /* need to be root */ 150 /* need to be root */
@@ -154,7 +156,10 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv)
154 * addgroup --gid num group 156 * addgroup --gid num group
155 * addgroup user group 157 * addgroup user group
156 * Check for min, max and missing args */ 158 * Check for min, max and missing args */
157 opts = getopt32long(argv, "^" "g:S" "\0" "-1:?2", addgroup_longopts, 159#if ENABLE_FEATURE_ADDUSER_TO_GROUP
160 opts =
161#endif
162 getopt32long(argv, "^" "g:S" "\0" "-1:?2", addgroup_longopts,
158 &gid 163 &gid
159 ); 164 );
160 /* move past the commandline options */ 165 /* move past the commandline options */
diff --git a/make_single_applets.sh b/make_single_applets.sh
index 329a27d32..aa1ace265 100755
--- a/make_single_applets.sh
+++ b/make_single_applets.sh
@@ -12,8 +12,9 @@ makeopts="-j9"
12test -f include/applets.h || { echo "No include/applets.h file"; exit 1; } 12test -f include/applets.h || { echo "No include/applets.h file"; exit 1; }
13apps="` 13apps="`
14grep ^IF_ include/applets.h \ 14grep ^IF_ include/applets.h \
15| grep -v ^IF_FEATURE_ \ 15| grep -v '^IF_FEATURE_' \
16| sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \ 16| sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
17| grep -v '^BUSYBOX$' \
17| sort | uniq 18| sort | uniq
18`" 19`"
19 20
diff --git a/networking/tftp.c b/networking/tftp.c
index 73a9829aa..4cd39186a 100644
--- a/networking/tftp.c
+++ b/networking/tftp.c
@@ -208,7 +208,7 @@ struct globals {
208#define G_error_pkt_reason (G.error_pkt[3]) 208#define G_error_pkt_reason (G.error_pkt[3])
209#define G_error_pkt_str ((char*)(G.error_pkt + 4)) 209#define G_error_pkt_str ((char*)(G.error_pkt + 4))
210 210
211#if ENABLE_FEATURE_TFTP_PROGRESS_BAR 211#if ENABLE_FEATURE_TFTP_PROGRESS_BAR && ENABLE_FEATURE_TFTP_BLOCKSIZE
212static void tftp_progress_update(void) 212static void tftp_progress_update(void)
213{ 213{
214 bb_progress_update(&G.pmt, 0, G.pos, G.size); 214 bb_progress_update(&G.pmt, 0, G.pos, G.size);
@@ -227,6 +227,7 @@ static void tftp_progress_done(void)
227 } 227 }
228} 228}
229#else 229#else
230# define tftp_progress_update() ((void)0)
230# define tftp_progress_init() ((void)0) 231# define tftp_progress_init() ((void)0)
231# define tftp_progress_done() ((void)0) 232# define tftp_progress_done() ((void)0)
232#endif 233#endif
diff --git a/procps/kill.c b/procps/kill.c
index 24cc903fc..c95afb8b3 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -108,7 +108,10 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
108{ 108{
109 char *arg; 109 char *arg;
110 pid_t pid; 110 pid_t pid;
111 int signo = SIGTERM, errors = 0, quiet = 0; 111 int signo = SIGTERM, errors = 0;
112#if ENABLE_KILL || ENABLE_KILLALL
113 int quiet = 0;
114#endif
112 115
113#if KILL_APPLET_CNT == 1 116#if KILL_APPLET_CNT == 1
114# define is_killall ENABLE_KILLALL 117# define is_killall ENABLE_KILLALL
@@ -170,7 +173,9 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
170 173
171 /* The -q quiet option */ 174 /* The -q quiet option */
172 if (is_killall && arg[1] == 'q' && arg[2] == '\0') { 175 if (is_killall && arg[1] == 'q' && arg[2] == '\0') {
176#if ENABLE_KILL || ENABLE_KILLALL
173 quiet = 1; 177 quiet = 1;
178#endif
174 arg = *++argv; 179 arg = *++argv;
175 if (!arg) 180 if (!arg)
176 bb_show_usage(); 181 bb_show_usage();
diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop
index 4d14b652f..edfbc5c58 100755
--- a/scripts/randomtest.loop
+++ b/scripts/randomtest.loop
@@ -66,6 +66,7 @@ while sleep 1; do
66 continue 66 continue
67 fi 67 fi
68 fi 68 fi
69 grep -i 'warning:' "$dir/make.log"
69 rm -rf -- "$dir" 70 rm -rf -- "$dir"
70 let cnt++ 71 let cnt++
71done 72done
diff --git a/shell/ash.c b/shell/ash.c
index e69ddb4ff..dfb7d4d8e 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9952,7 +9952,7 @@ evalcommand(union node *cmd, int flags)
9952 switch (cmdentry.cmdtype) { 9952 switch (cmdentry.cmdtype) {
9953 default: { 9953 default: {
9954 9954
9955#if ENABLE_FEATURE_SH_NOFORK 9955#if ENABLE_FEATURE_SH_NOFORK && NUM_APPLETS > 1
9956/* (1) BUG: if variables are set, we need to fork, or save/restore them 9956/* (1) BUG: if variables are set, we need to fork, or save/restore them
9957 * around run_nofork_applet() call. 9957 * around run_nofork_applet() call.
9958 * (2) Should this check also be done in forkshell()? 9958 * (2) Should this check also be done in forkshell()?
diff --git a/shell/hush.c b/shell/hush.c
index 708555ac4..df1b046ab 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -2278,7 +2278,7 @@ static int unset_local_var_len(const char *name, int name_len)
2278 return EXIT_SUCCESS; 2278 return EXIT_SUCCESS;
2279} 2279}
2280 2280
2281#if ENABLE_HUSH_UNSET 2281#if ENABLE_HUSH_UNSET || ENABLE_HUSH_GETOPTS
2282static int unset_local_var(const char *name) 2282static int unset_local_var(const char *name)
2283{ 2283{
2284 return unset_local_var_len(name, strlen(name)); 2284 return unset_local_var_len(name, strlen(name));
@@ -2300,7 +2300,7 @@ static void unset_vars(char **strings)
2300 free(strings); 2300 free(strings);
2301} 2301}
2302 2302
2303#if BASH_HOSTNAME_VAR || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_READ 2303#if BASH_HOSTNAME_VAR || ENABLE_FEATURE_SH_MATH || ENABLE_HUSH_READ || ENABLE_HUSH_GETOPTS
2304static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val) 2304static void FAST_FUNC set_local_var_from_halves(const char *name, const char *val)
2305{ 2305{
2306 char *var = xasprintf("%s=%s", name, val); 2306 char *var = xasprintf("%s=%s", name, val);
@@ -5534,7 +5534,7 @@ static int expand_on_ifs(int *ended_with_ifs, o_string *output, int n, const cha
5534static char *encode_then_expand_string(const char *str, int process_bkslash, int do_unbackslash) 5534static char *encode_then_expand_string(const char *str, int process_bkslash, int do_unbackslash)
5535{ 5535{
5536#if !BASH_PATTERN_SUBST 5536#if !BASH_PATTERN_SUBST
5537 const int do_unbackslash = 1; 5537 enum { do_unbackslash = 1 };
5538#endif 5538#endif
5539 char *exp_str; 5539 char *exp_str;
5540 struct in_str input; 5540 struct in_str input;
@@ -8139,7 +8139,7 @@ static NOINLINE int run_pipe(struct pipe *pi)
8139 return rcode; 8139 return rcode;
8140 } 8140 }
8141 8141
8142 if (ENABLE_FEATURE_SH_NOFORK) { 8142 if (ENABLE_FEATURE_SH_NOFORK && NUM_APPLETS > 1) {
8143 int n = find_applet_by_name(argv_expanded[0]); 8143 int n = find_applet_by_name(argv_expanded[0]);
8144 if (n >= 0 && APPLET_IS_NOFORK(n)) { 8144 if (n >= 0 && APPLET_IS_NOFORK(n)) {
8145 rcode = redirect_and_varexp_helper(&new_env, &old_vars, command, &squirrel, argv_expanded); 8145 rcode = redirect_and_varexp_helper(&new_env, &old_vars, command, &squirrel, argv_expanded);
@@ -8387,7 +8387,10 @@ static int run_list(struct pipe *pi)
8387 rword, cond_code, last_rword); 8387 rword, cond_code, last_rword);
8388 8388
8389 sv_errexit_depth = G.errexit_depth; 8389 sv_errexit_depth = G.errexit_depth;
8390 if (IF_HAS_KEYWORDS(rword == RES_IF || rword == RES_ELIF ||) 8390 if (
8391#if ENABLE_HUSH_IF
8392 rword == RES_IF || rword == RES_ELIF ||
8393#endif
8391 pi->followup != PIPE_SEQ 8394 pi->followup != PIPE_SEQ
8392 ) { 8395 ) {
8393 G.errexit_depth++; 8396 G.errexit_depth++;