diff options
| author | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-03 21:31:16 +0200 |
|---|---|---|
| committer | Denys Vlasenko <vda.linux@googlemail.com> | 2017-07-03 21:31:16 +0200 |
| commit | d4e4fdb5ce5ccc067b3d35d877f7a7d978869517 (patch) | |
| tree | bac3e4a55fa72db0c67d377b90869b4d63e8c3c9 | |
| parent | 2e989ef232e35750df573898077dd356003705b2 (diff) | |
| download | busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.tar.gz busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.tar.bz2 busybox-w32-d4e4fdb5ce5ccc067b3d35d877f7a7d978869517.zip | |
fixes for bugs found by make_single_applets.sh
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| -rw-r--r-- | archival/bbunzip.c | 11 | ||||
| -rw-r--r-- | include/libbb.h | 2 | ||||
| -rw-r--r-- | libbb/appletlib.c | 20 | ||||
| -rw-r--r-- | libbb/getopt32.c | 4 | ||||
| -rw-r--r-- | libbb/vfork_daemon_rexec.c | 3 | ||||
| -rw-r--r-- | networking/inetd.c | 17 | ||||
| -rwxr-xr-x | scripts/randomtest.loop | 26 | ||||
| -rw-r--r-- | shell/hush.c | 26 | ||||
| -rw-r--r-- | shell/shell_common.c | 4 | ||||
| -rw-r--r-- | util-linux/fdisk.c | 3 |
10 files changed, 75 insertions, 41 deletions
diff --git a/archival/bbunzip.c b/archival/bbunzip.c index c60f6e6df..f7a7ab354 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c | |||
| @@ -7,14 +7,19 @@ | |||
| 7 | #include "libbb.h" | 7 | #include "libbb.h" |
| 8 | #include "bb_archive.h" | 8 | #include "bb_archive.h" |
| 9 | 9 | ||
| 10 | //kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o | ||
| 11 | //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o | ||
| 12 | //kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o | ||
| 13 | //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o | ||
| 14 | |||
| 10 | /* lzop_main() uses bbunpack(), need this: */ | 15 | /* lzop_main() uses bbunpack(), need this: */ |
| 11 | //kbuild:lib-$(CONFIG_LZOP) += bbunzip.o | 16 | //kbuild:lib-$(CONFIG_LZOP) += bbunzip.o |
| 12 | //kbuild:lib-$(CONFIG_LZOPCAT) += bbunzip.o | 17 | //kbuild:lib-$(CONFIG_LZOPCAT) += bbunzip.o |
| 13 | //kbuild:lib-$(CONFIG_UNLZOP) += bbunzip.o | 18 | //kbuild:lib-$(CONFIG_UNLZOP) += bbunzip.o |
| 14 | /* bzip2_main() too: */ | 19 | /* bzip2_main() too: */ |
| 15 | //kbuild:lib-$(CONFIG_FEATURE_BZIP2_DECOMPRESS) += bbunzip.o | 20 | //kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o |
| 16 | /* gzip_main() too: */ | 21 | /* gzip_main() too: */ |
| 17 | //kbuild:lib-$(CONFIG_FEATURE_GZIP_DECOMPRESS) += bbunzip.o | 22 | //kbuild:lib-$(CONFIG_GZIP) += bbunzip.o |
| 18 | 23 | ||
| 19 | /* Note: must be kept in sync with archival/lzop.c */ | 24 | /* Note: must be kept in sync with archival/lzop.c */ |
| 20 | enum { | 25 | enum { |
| @@ -443,7 +448,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) | |||
| 443 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) | 448 | //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) |
| 444 | // APPLET_ODDNAME:name main location suid_type help | 449 | // APPLET_ODDNAME:name main location suid_type help |
| 445 | //applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) | 450 | //applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) |
| 446 | #if ENABLE_FEATURE_BZIP2_DECOMPRESS | 451 | #if ENABLE_FEATURE_BZIP2_DECOMPRESS || ENABLE_BUNZIP2 |
| 447 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 452 | int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
| 448 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) | 453 | int bunzip2_main(int argc UNUSED_PARAM, char **argv) |
| 449 | { | 454 | { |
diff --git a/include/libbb.h b/include/libbb.h index 9b72c97be..557978e66 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
| @@ -778,6 +778,8 @@ ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, | |||
| 778 | 778 | ||
| 779 | uint16_t inet_cksum(uint16_t *addr, int len) FAST_FUNC; | 779 | uint16_t inet_cksum(uint16_t *addr, int len) FAST_FUNC; |
| 780 | 780 | ||
| 781 | /* 0 if argv[0] is NULL: */ | ||
| 782 | unsigned string_array_len(char **argv) FAST_FUNC; | ||
| 781 | void overlapping_strcpy(char *dst, const char *src) FAST_FUNC; | 783 | void overlapping_strcpy(char *dst, const char *src) FAST_FUNC; |
| 782 | char *safe_strncpy(char *dst, const char *src, size_t size) FAST_FUNC; | 784 | char *safe_strncpy(char *dst, const char *src, size_t size) FAST_FUNC; |
| 783 | char *strncpy_IFNAMSIZ(char *dst, const char *src) FAST_FUNC; | 785 | char *strncpy_IFNAMSIZ(char *dst, const char *src) FAST_FUNC; |
diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 7f0d62060..2dea2b43a 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c | |||
| @@ -78,6 +78,17 @@ | |||
| 78 | #endif | 78 | #endif |
| 79 | 79 | ||
| 80 | 80 | ||
| 81 | unsigned FAST_FUNC string_array_len(char **argv) | ||
| 82 | { | ||
| 83 | char **start = argv; | ||
| 84 | |||
| 85 | while (*argv) | ||
| 86 | argv++; | ||
| 87 | |||
| 88 | return argv - start; | ||
| 89 | } | ||
| 90 | |||
| 91 | |||
| 81 | #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE | 92 | #if ENABLE_SHOW_USAGE && !ENABLE_FEATURE_COMPRESS_USAGE |
| 82 | static const char usage_messages[] ALIGN1 = UNPACKED_USAGE; | 93 | static const char usage_messages[] ALIGN1 = UNPACKED_USAGE; |
| 83 | #else | 94 | #else |
| @@ -868,10 +879,7 @@ static int busybox_main(char **argv) | |||
| 868 | # if NUM_APPLETS > 0 | 879 | # if NUM_APPLETS > 0 |
| 869 | void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv) | 880 | void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv) |
| 870 | { | 881 | { |
| 871 | int argc = 1; | 882 | int argc = string_array_len(argv); |
| 872 | |||
| 873 | while (argv[argc]) | ||
| 874 | argc++; | ||
| 875 | 883 | ||
| 876 | /* Reinit some shared global data */ | 884 | /* Reinit some shared global data */ |
| 877 | xfunc_error_retval = EXIT_FAILURE; | 885 | xfunc_error_retval = EXIT_FAILURE; |
| @@ -993,7 +1001,11 @@ int main(int argc UNUSED_PARAM, char **argv) | |||
| 993 | } | 1001 | } |
| 994 | /* applet_names in this case is just "applet\0\0" */ | 1002 | /* applet_names in this case is just "applet\0\0" */ |
| 995 | lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv)); | 1003 | lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv)); |
| 1004 | # if ENABLE_BUILD_LIBBUSYBOX | ||
| 1005 | return SINGLE_APPLET_MAIN(string_array_len(argv), argv); | ||
| 1006 | # else | ||
| 996 | return SINGLE_APPLET_MAIN(argc, argv); | 1007 | return SINGLE_APPLET_MAIN(argc, argv); |
| 1008 | # endif | ||
| 997 | 1009 | ||
| 998 | #elif !ENABLE_BUSYBOX && NUM_APPLETS == 0 | 1010 | #elif !ENABLE_BUSYBOX && NUM_APPLETS == 0 |
| 999 | 1011 | ||
diff --git a/libbb/getopt32.c b/libbb/getopt32.c index b87b83538..80f4cc060 100644 --- a/libbb/getopt32.c +++ b/libbb/getopt32.c | |||
| @@ -379,9 +379,7 @@ getopt32(char **argv, const char *applet_opts, ...) | |||
| 379 | int spec_flgs = 0; | 379 | int spec_flgs = 0; |
| 380 | 380 | ||
| 381 | /* skip 0: some applets cheat: they do not actually HAVE argv[0] */ | 381 | /* skip 0: some applets cheat: they do not actually HAVE argv[0] */ |
| 382 | argc = 1; | 382 | argc = 1 + string_array_len(argv + 1); |
| 383 | while (argv[argc]) | ||
| 384 | argc++; | ||
| 385 | 383 | ||
| 386 | va_start(p, applet_opts); | 384 | va_start(p, applet_opts); |
| 387 | 385 | ||
diff --git a/libbb/vfork_daemon_rexec.c b/libbb/vfork_daemon_rexec.c index fd481bf6e..2695f99ee 100644 --- a/libbb/vfork_daemon_rexec.c +++ b/libbb/vfork_daemon_rexec.c | |||
| @@ -16,6 +16,7 @@ | |||
| 16 | */ | 16 | */ |
| 17 | 17 | ||
| 18 | #include "busybox.h" /* uses applet tables */ | 18 | #include "busybox.h" /* uses applet tables */ |
| 19 | #include "NUM_APPLETS.h" | ||
| 19 | 20 | ||
| 20 | /* This does a fork/exec in one call, using vfork(). Returns PID of new child, | 21 | /* This does a fork/exec in one call, using vfork(). Returns PID of new child, |
| 21 | * -1 for failure. Runs argv[0], searching path if that has no / in it. */ | 22 | * -1 for failure. Runs argv[0], searching path if that has no / in it. */ |
| @@ -156,7 +157,7 @@ int FAST_FUNC run_nofork_applet(int applet_no, char **argv) | |||
| 156 | int FAST_FUNC spawn_and_wait(char **argv) | 157 | int FAST_FUNC spawn_and_wait(char **argv) |
| 157 | { | 158 | { |
| 158 | int rc; | 159 | int rc; |
| 159 | #if ENABLE_FEATURE_PREFER_APPLETS | 160 | #if ENABLE_FEATURE_PREFER_APPLETS && (NUM_APPLETS > 1) |
| 160 | int a = find_applet_by_name(argv[0]); | 161 | int a = find_applet_by_name(argv[0]); |
| 161 | 162 | ||
| 162 | if (a >= 0) { | 163 | if (a >= 0) { |
diff --git a/networking/inetd.c b/networking/inetd.c index 01e659f13..39169a935 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
| @@ -1513,8 +1513,11 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
| 1513 | } /* for (;;) */ | 1513 | } /* for (;;) */ |
| 1514 | } | 1514 | } |
| 1515 | 1515 | ||
| 1516 | #if !BB_MMU | 1516 | #if ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_ECHO \ |
| 1517 | || ENABLE_FEATURE_INETD_SUPPORT_BUILTIN_DISCARD | ||
| 1518 | # if !BB_MMU | ||
| 1517 | static const char *const cat_args[] = { "cat", NULL }; | 1519 | static const char *const cat_args[] = { "cat", NULL }; |
| 1520 | # endif | ||
| 1518 | #endif | 1521 | #endif |
| 1519 | 1522 | ||
| 1520 | /* | 1523 | /* |
| @@ -1525,14 +1528,14 @@ static const char *const cat_args[] = { "cat", NULL }; | |||
| 1525 | /* ARGSUSED */ | 1528 | /* ARGSUSED */ |
| 1526 | static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) | 1529 | static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) |
| 1527 | { | 1530 | { |
| 1528 | #if BB_MMU | 1531 | # if BB_MMU |
| 1529 | while (1) { | 1532 | while (1) { |
| 1530 | ssize_t sz = safe_read(s, line, LINE_SIZE); | 1533 | ssize_t sz = safe_read(s, line, LINE_SIZE); |
| 1531 | if (sz <= 0) | 1534 | if (sz <= 0) |
| 1532 | break; | 1535 | break; |
| 1533 | xwrite(s, line, sz); | 1536 | xwrite(s, line, sz); |
| 1534 | } | 1537 | } |
| 1535 | #else | 1538 | # else |
| 1536 | /* We are after vfork here! */ | 1539 | /* We are after vfork here! */ |
| 1537 | /* move network socket to stdin/stdout */ | 1540 | /* move network socket to stdin/stdout */ |
| 1538 | xmove_fd(s, STDIN_FILENO); | 1541 | xmove_fd(s, STDIN_FILENO); |
| @@ -1542,7 +1545,7 @@ static void FAST_FUNC echo_stream(int s, servtab_t *sep UNUSED_PARAM) | |||
| 1542 | xopen(bb_dev_null, O_WRONLY); | 1545 | xopen(bb_dev_null, O_WRONLY); |
| 1543 | BB_EXECVP("cat", (char**)cat_args); | 1546 | BB_EXECVP("cat", (char**)cat_args); |
| 1544 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ | 1547 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ |
| 1545 | #endif | 1548 | # endif |
| 1546 | } | 1549 | } |
| 1547 | static void FAST_FUNC echo_dg(int s, servtab_t *sep) | 1550 | static void FAST_FUNC echo_dg(int s, servtab_t *sep) |
| 1548 | { | 1551 | { |
| @@ -1566,10 +1569,10 @@ static void FAST_FUNC echo_dg(int s, servtab_t *sep) | |||
| 1566 | /* ARGSUSED */ | 1569 | /* ARGSUSED */ |
| 1567 | static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) | 1570 | static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) |
| 1568 | { | 1571 | { |
| 1569 | #if BB_MMU | 1572 | # if BB_MMU |
| 1570 | while (safe_read(s, line, LINE_SIZE) > 0) | 1573 | while (safe_read(s, line, LINE_SIZE) > 0) |
| 1571 | continue; | 1574 | continue; |
| 1572 | #else | 1575 | # else |
| 1573 | /* We are after vfork here! */ | 1576 | /* We are after vfork here! */ |
| 1574 | /* move network socket to stdin */ | 1577 | /* move network socket to stdin */ |
| 1575 | xmove_fd(s, STDIN_FILENO); | 1578 | xmove_fd(s, STDIN_FILENO); |
| @@ -1580,7 +1583,7 @@ static void FAST_FUNC discard_stream(int s, servtab_t *sep UNUSED_PARAM) | |||
| 1580 | xdup2(STDOUT_FILENO, STDERR_FILENO); | 1583 | xdup2(STDOUT_FILENO, STDERR_FILENO); |
| 1581 | BB_EXECVP("cat", (char**)cat_args); | 1584 | BB_EXECVP("cat", (char**)cat_args); |
| 1582 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ | 1585 | /* on failure we return to main, which does exit(EXIT_FAILURE) */ |
| 1583 | #endif | 1586 | # endif |
| 1584 | } | 1587 | } |
| 1585 | /* ARGSUSED */ | 1588 | /* ARGSUSED */ |
| 1586 | static void FAST_FUNC discard_dg(int s, servtab_t *sep UNUSED_PARAM) | 1589 | static void FAST_FUNC discard_dg(int s, servtab_t *sep UNUSED_PARAM) |
diff --git a/scripts/randomtest.loop b/scripts/randomtest.loop index 710f5fd05..4d14b652f 100755 --- a/scripts/randomtest.loop +++ b/scripts/randomtest.loop | |||
| @@ -1,7 +1,11 @@ | |||
| 1 | #!/bin/sh | 1 | #!/bin/sh |
| 2 | 2 | ||
| 3 | run_testsuite=false | ||
| 3 | run_testsuite=true | 4 | run_testsuite=true |
| 4 | 5 | ||
| 6 | run_single_test=false | ||
| 7 | run_single_test=true | ||
| 8 | |||
| 5 | test -d "$1" || { echo "'$1' is not a directory"; exit 1; } | 9 | test -d "$1" || { echo "'$1' is not a directory"; exit 1; } |
| 6 | test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } | 10 | test -x "$1/scripts/randomtest" || { echo "No scripts/randomtest in '$1'"; exit 1; } |
| 7 | 11 | ||
| @@ -40,6 +44,28 @@ while sleep 1; do | |||
| 40 | fi | 44 | fi |
| 41 | tail -n10 -- "$dir/testsuite/runtest.log" | 45 | tail -n10 -- "$dir/testsuite/runtest.log" |
| 42 | fi | 46 | fi |
| 47 | if $run_single_test; then | ||
| 48 | ( | ||
| 49 | cd -- "$dir" || exit 1 | ||
| 50 | echo "Running make_single_applets.sh in $dir..." | ||
| 51 | |||
| 52 | if grep -q '# CONFIG_FEATURE_TFTP_GET is not set' .config \ | ||
| 53 | && grep -q '# CONFIG_FEATURE_TFTP_PUT is not set' .config \ | ||
| 54 | ; then | ||
| 55 | # If both off, tftp[d] is ifdefed out and test fails. | ||
| 56 | # Enable one: | ||
| 57 | sed 's/# CONFIG_FEATURE_TFTP_GET is not set/CONFIG_FEATURE_TFTP_GET=y/' -i .config | ||
| 58 | fi | ||
| 59 | |||
| 60 | ./make_single_applets.sh | ||
| 61 | ) | ||
| 62 | if test $? != 0; then | ||
| 63 | echo "Failed make_single_applets.sh in $dir" | ||
| 64 | exit 1 # you may comment this out... | ||
| 65 | let fail++ | ||
| 66 | continue | ||
| 67 | fi | ||
| 68 | fi | ||
| 43 | rm -rf -- "$dir" | 69 | rm -rf -- "$dir" |
| 44 | let cnt++ | 70 | let cnt++ |
| 45 | done | 71 | done |
diff --git a/shell/hush.c b/shell/hush.c index fc6db316e..30add72f0 100644 --- a/shell/hush.c +++ b/shell/hush.c | |||
| @@ -1478,8 +1478,6 @@ typedef struct save_arg_t { | |||
| 1478 | 1478 | ||
| 1479 | static void save_and_replace_G_args(save_arg_t *sv, char **argv) | 1479 | static void save_and_replace_G_args(save_arg_t *sv, char **argv) |
| 1480 | { | 1480 | { |
| 1481 | int n; | ||
| 1482 | |||
| 1483 | sv->sv_argv0 = argv[0]; | 1481 | sv->sv_argv0 = argv[0]; |
| 1484 | sv->sv_g_argv = G.global_argv; | 1482 | sv->sv_g_argv = G.global_argv; |
| 1485 | sv->sv_g_argc = G.global_argc; | 1483 | sv->sv_g_argc = G.global_argc; |
| @@ -1489,10 +1487,7 @@ static void save_and_replace_G_args(save_arg_t *sv, char **argv) | |||
| 1489 | G.global_argv = argv; | 1487 | G.global_argv = argv; |
| 1490 | IF_HUSH_SET(G.global_args_malloced = 0;) | 1488 | IF_HUSH_SET(G.global_args_malloced = 0;) |
| 1491 | 1489 | ||
| 1492 | n = 1; | 1490 | G.global_argc = 1 + string_array_len(argv + 1); |
| 1493 | while (*++argv) | ||
| 1494 | n++; | ||
| 1495 | G.global_argc = n; | ||
| 1496 | } | 1491 | } |
| 1497 | 1492 | ||
| 1498 | static void restore_G_args(save_arg_t *sv, char **argv) | 1493 | static void restore_G_args(save_arg_t *sv, char **argv) |
| @@ -6809,13 +6804,11 @@ static void exec_function(char ***to_free, | |||
| 6809 | char **argv) | 6804 | char **argv) |
| 6810 | { | 6805 | { |
| 6811 | # if BB_MMU | 6806 | # if BB_MMU |
| 6812 | int n = 1; | 6807 | int n; |
| 6813 | 6808 | ||
| 6814 | argv[0] = G.global_argv[0]; | 6809 | argv[0] = G.global_argv[0]; |
| 6815 | G.global_argv = argv; | 6810 | G.global_argv = argv; |
| 6816 | while (*++argv) | 6811 | G.global_argc = n = 1 + string_array_len(argv + 1); |
| 6817 | n++; | ||
| 6818 | G.global_argc = n; | ||
| 6819 | /* On MMU, funcp->body is always non-NULL */ | 6812 | /* On MMU, funcp->body is always non-NULL */ |
| 6820 | n = run_list(funcp->body); | 6813 | n = run_list(funcp->body); |
| 6821 | fflush_all(); | 6814 | fflush_all(); |
| @@ -8811,12 +8804,8 @@ static int FAST_FUNC builtin_true(char **argv UNUSED_PARAM) | |||
| 8811 | #if ENABLE_HUSH_TEST || ENABLE_HUSH_ECHO || ENABLE_HUSH_PRINTF || ENABLE_HUSH_KILL | 8804 | #if ENABLE_HUSH_TEST || ENABLE_HUSH_ECHO || ENABLE_HUSH_PRINTF || ENABLE_HUSH_KILL |
| 8812 | static int run_applet_main(char **argv, int (*applet_main_func)(int argc, char **argv)) | 8805 | static int run_applet_main(char **argv, int (*applet_main_func)(int argc, char **argv)) |
| 8813 | { | 8806 | { |
| 8814 | int argc = 0; | 8807 | int argc = string_array_len(argv); |
| 8815 | while (*argv) { | 8808 | return applet_main_func(argc, argv); |
| 8816 | argc++; | ||
| 8817 | argv++; | ||
| 8818 | } | ||
| 8819 | return applet_main_func(argc, argv - argc); | ||
| 8820 | } | 8809 | } |
| 8821 | #endif | 8810 | #endif |
| 8822 | #if ENABLE_HUSH_TEST || BASH_TEST2 | 8811 | #if ENABLE_HUSH_TEST || BASH_TEST2 |
| @@ -9363,10 +9352,7 @@ static int FAST_FUNC builtin_set(char **argv) | |||
| 9363 | /* This realloc's G.global_argv */ | 9352 | /* This realloc's G.global_argv */ |
| 9364 | G.global_argv = pp = add_strings_to_strings(g_argv, argv, /*dup:*/ 1); | 9353 | G.global_argv = pp = add_strings_to_strings(g_argv, argv, /*dup:*/ 1); |
| 9365 | 9354 | ||
| 9366 | n = 1; | 9355 | G.global_argc = 1 + string_array_len(pp + 1); |
| 9367 | while (*++pp) | ||
| 9368 | n++; | ||
| 9369 | G.global_argc = n; | ||
| 9370 | 9356 | ||
| 9371 | return EXIT_SUCCESS; | 9357 | return EXIT_SUCCESS; |
| 9372 | 9358 | ||
diff --git a/shell/shell_common.c b/shell/shell_common.c index 03b7d0b75..bf56f3d78 100644 --- a/shell/shell_common.c +++ b/shell/shell_common.c | |||
| @@ -405,9 +405,7 @@ shell_builtin_ulimit(char **argv) | |||
| 405 | */ | 405 | */ |
| 406 | GETOPT_RESET(); | 406 | GETOPT_RESET(); |
| 407 | 407 | ||
| 408 | argc = 1; | 408 | argc = string_array_len(argv); |
| 409 | while (argv[argc]) | ||
| 410 | argc++; | ||
| 411 | 409 | ||
| 412 | opts = 0; | 410 | opts = 0; |
| 413 | while (1) { | 411 | while (1) { |
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 916d4e30e..4467525c7 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c | |||
| @@ -185,6 +185,8 @@ struct hd_geometry { | |||
| 185 | 185 | ||
| 186 | #define HDIO_GETGEO 0x0301 /* get device geometry */ | 186 | #define HDIO_GETGEO 0x0301 /* get device geometry */ |
| 187 | 187 | ||
| 188 | /* TODO: #if ENABLE_FEATURE_FDISK_WRITABLE */ | ||
| 189 | /* (currently fdisk_sun/sgi.c do not have proper WRITABLE #ifs) */ | ||
| 188 | static const char msg_building_new_label[] ALIGN1 = | 190 | static const char msg_building_new_label[] ALIGN1 = |
| 189 | "Building a new %s. Changes will remain in memory only,\n" | 191 | "Building a new %s. Changes will remain in memory only,\n" |
| 190 | "until you decide to write them. After that the previous content\n" | 192 | "until you decide to write them. After that the previous content\n" |
| @@ -192,6 +194,7 @@ static const char msg_building_new_label[] ALIGN1 = | |||
| 192 | 194 | ||
| 193 | static const char msg_part_already_defined[] ALIGN1 = | 195 | static const char msg_part_already_defined[] ALIGN1 = |
| 194 | "Partition %u is already defined, delete it before re-adding\n"; | 196 | "Partition %u is already defined, delete it before re-adding\n"; |
| 197 | /* #endif */ | ||
| 195 | 198 | ||
| 196 | 199 | ||
| 197 | struct partition { | 200 | struct partition { |
