diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-24 04:37:59 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-11-24 04:37:59 +0000 |
commit | 80297d5f0cbe8a3de497804dcbb1a89e6f9c1562 (patch) | |
tree | f34fce2257aff722f25347bfce7e1375d7df5db6 | |
parent | 3db254c8866de390c327d759ba615693e45aff6f (diff) | |
download | busybox-w32-1_8_2.tar.gz busybox-w32-1_8_2.tar.bz2 busybox-w32-1_8_2.zip |
Apply all post-1.8.1 patches1_8_2
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | archival/libunarchive/decompress_unzip.c | 1 | ||||
-rw-r--r-- | archival/libunarchive/get_header_tar.c | 5 | ||||
-rw-r--r-- | archival/tar.c | 5 | ||||
-rw-r--r-- | coreutils/tr.c | 8 | ||||
-rw-r--r-- | networking/inetd.c | 2 | ||||
-rwxr-xr-x | scripts/trylink | 25 | ||||
-rw-r--r-- | shell/lash.c | 29 |
8 files changed, 47 insertions, 30 deletions
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 8 | 2 | PATCHLEVEL = 8 |
3 | SUBLEVEL = 1 | 3 | SUBLEVEL = 2 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
6 | 6 | ||
diff --git a/archival/libunarchive/decompress_unzip.c b/archival/libunarchive/decompress_unzip.c index 0572bee68..04d6f1556 100644 --- a/archival/libunarchive/decompress_unzip.c +++ b/archival/libunarchive/decompress_unzip.c | |||
@@ -1178,6 +1178,7 @@ unpack_gz_stream(int in, int out) | |||
1178 | ALLOC_STATE; | 1178 | ALLOC_STATE; |
1179 | bytebuffer_max = 0x8000; | 1179 | bytebuffer_max = 0x8000; |
1180 | bytebuffer = xmalloc(bytebuffer_max); | 1180 | bytebuffer = xmalloc(bytebuffer_max); |
1181 | gunzip_src_fd = in; | ||
1181 | 1182 | ||
1182 | again: | 1183 | again: |
1183 | if (!check_header_gzip(PASS_STATE_ONLY)) { | 1184 | if (!check_header_gzip(PASS_STATE_ONLY)) { |
diff --git a/archival/libunarchive/get_header_tar.c b/archival/libunarchive/get_header_tar.c index e8ef92994..bbf088cd8 100644 --- a/archival/libunarchive/get_header_tar.c +++ b/archival/libunarchive/get_header_tar.c | |||
@@ -59,8 +59,9 @@ char get_header_tar(archive_handle_t *archive_handle) | |||
59 | char chksum[8]; /* 148-155 */ | 59 | char chksum[8]; /* 148-155 */ |
60 | char typeflag; /* 156-156 */ | 60 | char typeflag; /* 156-156 */ |
61 | char linkname[100]; /* 157-256 */ | 61 | char linkname[100]; /* 157-256 */ |
62 | char magic[6]; /* 257-262 */ | 62 | /* POSIX: "ustar" NUL "00" */ |
63 | char version[2]; /* 263-264 */ | 63 | /* GNU tar: "ustar " NUL */ |
64 | char magic[8]; /* 257-264 */ | ||
64 | char uname[32]; /* 265-296 */ | 65 | char uname[32]; /* 265-296 */ |
65 | char gname[32]; /* 297-328 */ | 66 | char gname[32]; /* 297-328 */ |
66 | char devmajor[8]; /* 329-336 */ | 67 | char devmajor[8]; /* 329-336 */ |
diff --git a/archival/tar.c b/archival/tar.c index 3fe188656..aac706b96 100644 --- a/archival/tar.c +++ b/archival/tar.c | |||
@@ -50,8 +50,9 @@ struct TarHeader { /* byte offset */ | |||
50 | char chksum[8]; /* 148-155 */ | 50 | char chksum[8]; /* 148-155 */ |
51 | char typeflag; /* 156-156 */ | 51 | char typeflag; /* 156-156 */ |
52 | char linkname[NAME_SIZE]; /* 157-256 */ | 52 | char linkname[NAME_SIZE]; /* 157-256 */ |
53 | char magic[6]; /* 257-262 */ | 53 | /* POSIX: "ustar" NUL "00" */ |
54 | char version[2]; /* 263-264 */ | 54 | /* GNU tar: "ustar " NUL */ |
55 | char magic[8]; /* 257-264 */ | ||
55 | char uname[32]; /* 265-296 */ | 56 | char uname[32]; /* 265-296 */ |
56 | char gname[32]; /* 297-328 */ | 57 | char gname[32]; /* 297-328 */ |
57 | char devmajor[8]; /* 329-336 */ | 58 | char devmajor[8]; /* 329-336 */ |
diff --git a/coreutils/tr.c b/coreutils/tr.c index 9521bbcd5..e60e08b25 100644 --- a/coreutils/tr.c +++ b/coreutils/tr.c | |||
@@ -173,7 +173,8 @@ int tr_main(int argc, char **argv) | |||
173 | int idx = 1; | 173 | int idx = 1; |
174 | int i; | 174 | int i; |
175 | smalluint flags = 0; | 175 | smalluint flags = 0; |
176 | size_t read_chars = 0, in_index = 0, out_index = 0, c, coded, last = -1; | 176 | ssize_t read_chars = 0; |
177 | size_t in_index = 0, out_index = 0, c, coded, last = -1; | ||
177 | RESERVE_CONFIG_UBUFFER(output, BUFSIZ); | 178 | RESERVE_CONFIG_UBUFFER(output, BUFSIZ); |
178 | RESERVE_CONFIG_BUFFER(vector, ASCII+1); | 179 | RESERVE_CONFIG_BUFFER(vector, ASCII+1); |
179 | RESERVE_CONFIG_BUFFER(invec, ASCII+1); | 180 | RESERVE_CONFIG_BUFFER(invec, ASCII+1); |
@@ -223,8 +224,9 @@ int tr_main(int argc, char **argv) | |||
223 | } | 224 | } |
224 | read_chars = read(STDIN_FILENO, tr_buf, BUFSIZ); | 225 | read_chars = read(STDIN_FILENO, tr_buf, BUFSIZ); |
225 | if (read_chars <= 0) { | 226 | if (read_chars <= 0) { |
226 | if (write(STDOUT_FILENO, (char *)output, out_index) != out_index) | 227 | xwrite(STDOUT_FILENO, (char *)output, out_index); |
227 | bb_perror_msg(bb_msg_write_error); | 228 | if (read_chars < 0) |
229 | bb_perror_msg_and_die(bb_msg_read_error); | ||
228 | exit(EXIT_SUCCESS); | 230 | exit(EXIT_SUCCESS); |
229 | } | 231 | } |
230 | in_index = 0; | 232 | in_index = 0; |
diff --git a/networking/inetd.c b/networking/inetd.c index 94d3df6e2..70c480f0f 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -813,7 +813,7 @@ static servtab_t *getconfigent(void) | |||
813 | sep->se_bi = NULL; | 813 | sep->se_bi = NULL; |
814 | #endif | 814 | #endif |
815 | argc = 0; | 815 | argc = 0; |
816 | for (; cp; arg = skip(&cp)) { | 816 | for (arg = skip(&cp); cp; arg = skip(&cp)) { |
817 | if (argc < MAXARGV) | 817 | if (argc < MAXARGV) |
818 | sep->se_argv[argc++] = xxstrdup(arg); | 818 | sep->se_argv[argc++] = xxstrdup(arg); |
819 | } | 819 | } |
diff --git a/scripts/trylink b/scripts/trylink index 7fe262baa..4fea6fe76 100755 --- a/scripts/trylink +++ b/scripts/trylink | |||
@@ -46,6 +46,14 @@ try() { | |||
46 | return $exitcode | 46 | return $exitcode |
47 | } | 47 | } |
48 | 48 | ||
49 | check_cc() { | ||
50 | if $CC $1 -shared -o /dev/null -xc /dev/null > /dev/null 2>&1; then | ||
51 | echo "$1"; | ||
52 | else | ||
53 | echo "$2"; | ||
54 | fi | ||
55 | } | ||
56 | |||
49 | EXE="$1" | 57 | EXE="$1" |
50 | CC="$2" | 58 | CC="$2" |
51 | LDFLAGS="$3" | 59 | LDFLAGS="$3" |
@@ -53,6 +61,9 @@ O_FILES="$4" | |||
53 | A_FILES="$5" | 61 | A_FILES="$5" |
54 | LDLIBS="$6" | 62 | LDLIBS="$6" |
55 | 63 | ||
64 | # The -Wl,--sort-section option is not supported by older versions of ld | ||
65 | SORT_SECTION=`check_cc "-Wl,--sort-section -Wl,alignment" ""` | ||
66 | |||
56 | # Sanitize lib list (dups, extra spaces etc) | 67 | # Sanitize lib list (dups, extra spaces etc) |
57 | LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs` | 68 | LDLIBS=`echo "$LDLIBS" | xargs -n1 | sort | uniq | xargs` |
58 | 69 | ||
@@ -64,7 +75,7 @@ test "x$l_list" != "x" && l_list="-Wl,--start-group $l_list -Wl,--end-group" | |||
64 | try $CC $LDFLAGS \ | 75 | try $CC $LDFLAGS \ |
65 | -o $EXE \ | 76 | -o $EXE \ |
66 | -Wl,--sort-common \ | 77 | -Wl,--sort-common \ |
67 | -Wl,--sort-section -Wl,alignment \ | 78 | $SORT_SECTION \ |
68 | -Wl,--gc-sections \ | 79 | -Wl,--gc-sections \ |
69 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 80 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
70 | $l_list \ | 81 | $l_list \ |
@@ -88,7 +99,7 @@ while test "$LDLIBS"; do | |||
88 | try $CC $LDFLAGS \ | 99 | try $CC $LDFLAGS \ |
89 | -o $EXE \ | 100 | -o $EXE \ |
90 | -Wl,--sort-common \ | 101 | -Wl,--sort-common \ |
91 | -Wl,--sort-section -Wl,alignment \ | 102 | $SORT_SECTION \ |
92 | -Wl,--gc-sections \ | 103 | -Wl,--gc-sections \ |
93 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 104 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
94 | $l_list | 105 | $l_list |
@@ -117,7 +128,7 @@ if ! test -f busybox_ldscript; then | |||
117 | try $CC $LDFLAGS \ | 128 | try $CC $LDFLAGS \ |
118 | -o $EXE \ | 129 | -o $EXE \ |
119 | -Wl,--sort-common \ | 130 | -Wl,--sort-common \ |
120 | -Wl,--sort-section -Wl,alignment \ | 131 | $SORT_SECTION \ |
121 | -Wl,--gc-sections \ | 132 | -Wl,--gc-sections \ |
122 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 133 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
123 | $l_list \ | 134 | $l_list \ |
@@ -139,7 +150,7 @@ else | |||
139 | try $CC $LDFLAGS \ | 150 | try $CC $LDFLAGS \ |
140 | -o $EXE \ | 151 | -o $EXE \ |
141 | -Wl,--sort-common \ | 152 | -Wl,--sort-common \ |
142 | -Wl,--sort-section -Wl,alignment \ | 153 | $SORT_SECTION \ |
143 | -Wl,--gc-sections \ | 154 | -Wl,--gc-sections \ |
144 | -Wl,-T -Wl,busybox_ldscript \ | 155 | -Wl,-T -Wl,busybox_ldscript \ |
145 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ | 156 | -Wl,--start-group $O_FILES $A_FILES -Wl,--end-group \ |
@@ -174,7 +185,7 @@ if test "$CONFIG_BUILD_LIBBUSYBOX" = y; then | |||
174 | -Wl,-soname="libbusybox.so.$BB_VER" \ | 185 | -Wl,-soname="libbusybox.so.$BB_VER" \ |
175 | -Wl,--undefined=lbb_main \ | 186 | -Wl,--undefined=lbb_main \ |
176 | -Wl,--sort-common \ | 187 | -Wl,--sort-common \ |
177 | -Wl,--sort-section -Wl,alignment \ | 188 | $SORT_SECTION \ |
178 | -Wl,--start-group $A_FILES -Wl,--end-group \ | 189 | -Wl,--start-group $A_FILES -Wl,--end-group \ |
179 | $l_list \ | 190 | $l_list \ |
180 | -Wl,--warn-common \ | 191 | -Wl,--warn-common \ |
@@ -195,7 +206,7 @@ if test "$CONFIG_FEATURE_SHARED_BUSYBOX" = y; then | |||
195 | try $CC $LDFLAGS \ | 206 | try $CC $LDFLAGS \ |
196 | -o $EXE \ | 207 | -o $EXE \ |
197 | -Wl,--sort-common \ | 208 | -Wl,--sort-common \ |
198 | -Wl,--sort-section -Wl,alignment \ | 209 | $SORT_SECTION \ |
199 | -Wl,--gc-sections \ | 210 | -Wl,--gc-sections \ |
200 | -Wl,--start-group $O_FILES -Wl,--end-group \ | 211 | -Wl,--start-group $O_FILES -Wl,--end-group \ |
201 | -L"$sharedlib_dir" -lbusybox \ | 212 | -L"$sharedlib_dir" -lbusybox \ |
@@ -234,7 +245,7 @@ int main(int argc, char **argv) | |||
234 | try $CC $LDFLAGS "$sharedlib_dir/applet.c" \ | 245 | try $CC $LDFLAGS "$sharedlib_dir/applet.c" \ |
235 | -o $EXE \ | 246 | -o $EXE \ |
236 | -Wl,--sort-common \ | 247 | -Wl,--sort-common \ |
237 | -Wl,--sort-section -Wl,alignment \ | 248 | $SORT_SECTION \ |
238 | -Wl,--gc-sections \ | 249 | -Wl,--gc-sections \ |
239 | -L"$sharedlib_dir" -lbusybox \ | 250 | -L"$sharedlib_dir" -lbusybox \ |
240 | -Wl,--warn-common \ | 251 | -Wl,--warn-common \ |
diff --git a/shell/lash.c b/shell/lash.c index ce1ce7f6a..781dfdb5a 100644 --- a/shell/lash.c +++ b/shell/lash.c | |||
@@ -157,8 +157,8 @@ static int shell_context; /* Type prompt trigger (PS1 or PS2) */ | |||
157 | static char *cwd; | 157 | static char *cwd; |
158 | static char *local_pending_command; | 158 | static char *local_pending_command; |
159 | static struct jobset job_list = { NULL, NULL }; | 159 | static struct jobset job_list = { NULL, NULL }; |
160 | static int argc; | 160 | static int global_argc; |
161 | static char **argv; | 161 | static char **global_argv; |
162 | static llist_t *close_me_list; | 162 | static llist_t *close_me_list; |
163 | static int last_return_code; | 163 | static int last_return_code; |
164 | static int last_bg_pid; | 164 | static int last_bg_pid; |
@@ -810,16 +810,16 @@ static int expand_arguments(char *command) | |||
810 | var = itoa(getpid()); | 810 | var = itoa(getpid()); |
811 | break; | 811 | break; |
812 | case '#': | 812 | case '#': |
813 | var = itoa(argc-1); | 813 | var = itoa(global_argc - 1); |
814 | break; | 814 | break; |
815 | case '0':case '1':case '2':case '3':case '4': | 815 | case '0':case '1':case '2':case '3':case '4': |
816 | case '5':case '6':case '7':case '8':case '9': | 816 | case '5':case '6':case '7':case '8':case '9': |
817 | { | 817 | { |
818 | int ixx = *(dst+1)-48+1; | 818 | int ixx = *(dst+1)-48+1; |
819 | if (ixx >= argc) { | 819 | if (ixx >= global_argc) { |
820 | var = '\0'; | 820 | var = '\0'; |
821 | } else { | 821 | } else { |
822 | var = argv[ixx]; | 822 | var = global_argv[ixx]; |
823 | } | 823 | } |
824 | } | 824 | } |
825 | break; | 825 | break; |
@@ -1492,12 +1492,13 @@ static inline void setup_job_control(void) | |||
1492 | #endif | 1492 | #endif |
1493 | 1493 | ||
1494 | int lash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 1494 | int lash_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
1495 | int lash_main(int argc_l, char **argv_l) | 1495 | int lash_main(int argc, char **argv) |
1496 | { | 1496 | { |
1497 | unsigned opt; | 1497 | unsigned opt; |
1498 | FILE *input = stdin; | 1498 | FILE *input = stdin; |
1499 | argc = argc_l; | 1499 | |
1500 | argv = argv_l; | 1500 | global_argc = argc; |
1501 | global_argv = argv; | ||
1501 | 1502 | ||
1502 | #if ENABLE_FEATURE_EDITING | 1503 | #if ENABLE_FEATURE_EDITING |
1503 | line_input_state = new_line_input_t(FOR_SHELL); | 1504 | line_input_state = new_line_input_t(FOR_SHELL); |
@@ -1510,7 +1511,7 @@ int lash_main(int argc_l, char **argv_l) | |||
1510 | job_list.fg = NULL; | 1511 | job_list.fg = NULL; |
1511 | last_return_code = 1; | 1512 | last_return_code = 1; |
1512 | 1513 | ||
1513 | if (argv[0] && argv[0][0] == '-') { | 1514 | if (global_argv[0] && global_argv[0][0] == '-') { |
1514 | FILE *prof_input; | 1515 | FILE *prof_input; |
1515 | prof_input = fopen("/etc/profile", "r"); | 1516 | prof_input = fopen("/etc/profile", "r"); |
1516 | if (prof_input) { | 1517 | if (prof_input) { |
@@ -1522,13 +1523,13 @@ int lash_main(int argc_l, char **argv_l) | |||
1522 | } | 1523 | } |
1523 | } | 1524 | } |
1524 | 1525 | ||
1525 | opt = getopt32(argv_l, "+ic:", &local_pending_command); | 1526 | opt = getopt32(argv, "+ic:", &local_pending_command); |
1526 | #define LASH_OPT_i (1<<0) | 1527 | #define LASH_OPT_i (1<<0) |
1527 | #define LASH_OPT_c (1<<1) | 1528 | #define LASH_OPT_c (1<<1) |
1528 | if (opt & LASH_OPT_c) { | 1529 | if (opt & LASH_OPT_c) { |
1529 | input = NULL; | 1530 | input = NULL; |
1530 | optind++; | 1531 | optind++; |
1531 | argv += optind; | 1532 | global_argv += optind; |
1532 | } | 1533 | } |
1533 | /* A shell is interactive if the `-i' flag was given, or if all of | 1534 | /* A shell is interactive if the `-i' flag was given, or if all of |
1534 | * the following conditions are met: | 1535 | * the following conditions are met: |
@@ -1537,7 +1538,7 @@ int lash_main(int argc_l, char **argv_l) | |||
1537 | * standard input is a terminal | 1538 | * standard input is a terminal |
1538 | * standard output is a terminal | 1539 | * standard output is a terminal |
1539 | * Refer to Posix.2, the description of the `sh' utility. */ | 1540 | * Refer to Posix.2, the description of the `sh' utility. */ |
1540 | if (argv[optind] == NULL && input == stdin | 1541 | if (global_argv[optind] == NULL && input == stdin |
1541 | && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) | 1542 | && isatty(STDIN_FILENO) && isatty(STDOUT_FILENO) |
1542 | ) { | 1543 | ) { |
1543 | opt |= LASH_OPT_i; | 1544 | opt |= LASH_OPT_i; |
@@ -1550,9 +1551,9 @@ int lash_main(int argc_l, char **argv_l) | |||
1550 | "Enter 'help' for a list of built-in commands.\n\n", | 1551 | "Enter 'help' for a list of built-in commands.\n\n", |
1551 | bb_banner); | 1552 | bb_banner); |
1552 | } | 1553 | } |
1553 | } else if (!local_pending_command && argv[optind]) { | 1554 | } else if (!local_pending_command && global_argv[optind]) { |
1554 | //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); | 1555 | //printf( "optind=%d argv[optind]='%s'\n", optind, argv[optind]); |
1555 | input = xfopen(argv[optind], "r"); | 1556 | input = xfopen(global_argv[optind], "r"); |
1556 | /* be lazy, never mark this closed */ | 1557 | /* be lazy, never mark this closed */ |
1557 | llist_add_to(&close_me_list, (void *)(long)fileno(input)); | 1558 | llist_add_to(&close_me_list, (void *)(long)fileno(input)); |
1558 | } | 1559 | } |