aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-03-13 02:39:10 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2011-03-13 02:39:10 +0100
commit30f0ea6cab956ed59ecc5de82459187763a2b868 (patch)
tree2f93977a3de79ff6b517b2a291b643502267ccc9
parent92e531458a6c0e6464fbdc1463f91edc7fb752c7 (diff)
downloadbusybox-w32-1_18_4.tar.gz
busybox-w32-1_18_4.tar.bz2
busybox-w32-1_18_4.zip
Apply post-1.18.3 fixes, bump version to 1.18.41_18_4
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--Config.in1
-rw-r--r--Makefile2
-rw-r--r--coreutils/cksum.c1
-rw-r--r--modutils/modutils-24.c5
-rw-r--r--networking/wget.c65
-rw-r--r--scripts/kconfig/mconf.c2
-rw-r--r--sysklogd/klogd.c31
7 files changed, 88 insertions, 19 deletions
diff --git a/Config.in b/Config.in
index 140572e2d..5e31d20c7 100644
--- a/Config.in
+++ b/Config.in
@@ -126,7 +126,6 @@ config FEATURE_INSTALLER
126config INSTALL_NO_USR 126config INSTALL_NO_USR
127 bool "Don't use /usr" 127 bool "Don't use /usr"
128 default n 128 default n
129 depends on FEATURE_INSTALLER
130 help 129 help
131 Disable use of /usr. busybox --install and "make install" 130 Disable use of /usr. busybox --install and "make install"
132 will install applets only to /bin and /sbin, 131 will install applets only to /bin and /sbin,
diff --git a/Makefile b/Makefile
index 656ee2c79..cb0e3e434 100644
--- a/Makefile
+++ b/Makefile
@@ -1,6 +1,6 @@
1VERSION = 1 1VERSION = 1
2PATCHLEVEL = 18 2PATCHLEVEL = 18
3SUBLEVEL = 3 3SUBLEVEL = 4
4EXTRAVERSION = 4EXTRAVERSION =
5NAME = Unnamed 5NAME = Unnamed
6 6
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 7a37e6add..53fb87a78 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -38,6 +38,7 @@ int cksum_main(int argc UNUSED_PARAM, char **argv)
38 38
39#define read_buf bb_common_bufsiz1 39#define read_buf bb_common_bufsiz1
40 while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) { 40 while ((bytes_read = safe_read(fd, read_buf, sizeof(read_buf))) > 0) {
41 length += bytes_read;
41 crc = crc32_block_endian1(crc, read_buf, bytes_read, crc32_table); 42 crc = crc32_block_endian1(crc, read_buf, bytes_read, crc32_table);
42 } 43 }
43 close(fd); 44 close(fd);
diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c
index 2b34954c0..bd650cab5 100644
--- a/modutils/modutils-24.c
+++ b/modutils/modutils-24.c
@@ -2474,6 +2474,7 @@ new_process_module_arguments(struct obj_file *f, const char *options)
2474 n = 0; 2474 n = 0;
2475 p = val; 2475 p = val;
2476 while (*p != 0) { 2476 while (*p != 0) {
2477 char sv_ch;
2477 char *endp; 2478 char *endp;
2478 2479
2479 if (++n > max) 2480 if (++n > max)
@@ -2482,14 +2483,17 @@ new_process_module_arguments(struct obj_file *f, const char *options)
2482 switch (*pinfo) { 2483 switch (*pinfo) {
2483 case 's': 2484 case 's':
2484 len = strcspn(p, ","); 2485 len = strcspn(p, ",");
2486 sv_ch = p[len];
2485 p[len] = 0; 2487 p[len] = 0;
2486 obj_string_patch(f, sym->secidx, 2488 obj_string_patch(f, sym->secidx,
2487 loc - contents, p); 2489 loc - contents, p);
2488 loc += tgt_sizeof_char_p; 2490 loc += tgt_sizeof_char_p;
2489 p += len; 2491 p += len;
2492 *p = sv_ch;
2490 break; 2493 break;
2491 case 'c': 2494 case 'c':
2492 len = strcspn(p, ","); 2495 len = strcspn(p, ",");
2496 sv_ch = p[len];
2493 p[len] = 0; 2497 p[len] = 0;
2494 if (len >= charssize) 2498 if (len >= charssize)
2495 bb_error_msg_and_die("string too long for %s (max %ld)", param, 2499 bb_error_msg_and_die("string too long for %s (max %ld)", param,
@@ -2497,6 +2501,7 @@ new_process_module_arguments(struct obj_file *f, const char *options)
2497 strcpy((char *) loc, p); 2501 strcpy((char *) loc, p);
2498 loc += charssize; 2502 loc += charssize;
2499 p += len; 2503 p += len;
2504 *p = sv_ch;
2500 break; 2505 break;
2501 case 'b': 2506 case 'b':
2502 *loc++ = strtoul(p, &endp, 0); 2507 *loc++ = strtoul(p, &endp, 0);
diff --git a/networking/wget.c b/networking/wget.c
index 0db9b3365..afe0d3ab7 100644
--- a/networking/wget.c
+++ b/networking/wget.c
@@ -446,7 +446,7 @@ static FILE* prepare_ftp_session(FILE **dfpp, struct host_info *target, len_and_
446 446
447static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd) 447static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd)
448{ 448{
449 char buf[512]; 449 char buf[4*1024]; /* made bigger to speed up local xfers */
450#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT 450#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
451# if ENABLE_FEATURE_WGET_TIMEOUT 451# if ENABLE_FEATURE_WGET_TIMEOUT
452 unsigned second_cnt; 452 unsigned second_cnt;
@@ -455,7 +455,6 @@ static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd)
455 455
456 polldata.fd = fileno(dfp); 456 polldata.fd = fileno(dfp);
457 polldata.events = POLLIN | POLLPRI; 457 polldata.events = POLLIN | POLLPRI;
458 ndelay_on(polldata.fd);
459#endif 458#endif
460 progress_meter(PROGRESS_START); 459 progress_meter(PROGRESS_START);
461 460
@@ -464,6 +463,10 @@ static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd)
464 463
465 /* Loops only if chunked */ 464 /* Loops only if chunked */
466 while (1) { 465 while (1) {
466
467#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
468 ndelay_on(polldata.fd);
469#endif
467 while (1) { 470 while (1) {
468 int n; 471 int n;
469 unsigned rdsz; 472 unsigned rdsz;
@@ -493,22 +496,46 @@ static void NOINLINE retrieve_file_data(FILE *dfp, int output_fd)
493 progress_meter(PROGRESS_BUMP); 496 progress_meter(PROGRESS_BUMP);
494 } 497 }
495#endif 498#endif
499 /* fread internally uses read loop, which in our case
500 * is usually exited when we get EAGAIN.
501 * In this case, libc sets error marker on the stream.
502 * Need to clear it before next fread to avoid possible
503 * rare false positive ferror below. Rare because usually
504 * fread gets more than zero bytes, and we don't fall
505 * into if (n <= 0) ...
506 */
507 clearerr(dfp);
508 errno = 0;
496 n = safe_fread(buf, rdsz, dfp); 509 n = safe_fread(buf, rdsz, dfp);
510 /* man fread:
511 * If error occurs, or EOF is reached, the return value
512 * is a short item count (or zero).
513 * fread does not distinguish between EOF and error.
514 */
497 if (n <= 0) { 515 if (n <= 0) {
498 if (ferror(dfp)) { 516#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
499 /* perror will not work: ferror doesn't set errno */ 517 if (errno == EAGAIN) /* poll lied, there is no data? */
500 bb_error_msg_and_die(bb_msg_read_error); 518 continue; /* yes */
501 } 519#endif
502 break; 520 if (ferror(dfp))
521 bb_perror_msg_and_die(bb_msg_read_error);
522 break; /* EOF, not error */
503 } 523 }
524
504 xwrite(output_fd, buf, n); 525 xwrite(output_fd, buf, n);
505#if ENABLE_FEATURE_WGET_STATUSBAR 526#if ENABLE_FEATURE_WGET_STATUSBAR
506 G.transferred += n; 527 G.transferred += n;
507 progress_meter(PROGRESS_BUMP); 528 progress_meter(PROGRESS_BUMP);
508#endif 529#endif
509 if (G.got_clen) 530 if (G.got_clen) {
510 G.content_len -= n; 531 G.content_len -= n;
532 if (G.content_len == 0)
533 break;
534 }
511 } 535 }
536#if ENABLE_FEATURE_WGET_STATUSBAR || ENABLE_FEATURE_WGET_TIMEOUT
537 ndelay_off(polldata.fd);
538#endif
512 539
513 if (!G.chunked) 540 if (!G.chunked)
514 break; 541 break;
@@ -706,6 +733,11 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
706 fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n", 733 fprintf(sfp, "Host: %s\r\nUser-Agent: %s\r\n",
707 target.host, user_agent); 734 target.host, user_agent);
708 735
736 /* Ask server to close the connection as soon as we are done
737 * (IOW: we do not intend to send more requests)
738 */
739 fprintf(sfp, "Connection: close\r\n");
740
709#if ENABLE_FEATURE_WGET_AUTHENTICATION 741#if ENABLE_FEATURE_WGET_AUTHENTICATION
710 if (target.user) { 742 if (target.user) {
711 fprintf(sfp, "Proxy-Authorization: Basic %s\r\n"+6, 743 fprintf(sfp, "Proxy-Authorization: Basic %s\r\n"+6,
@@ -719,22 +751,25 @@ int wget_main(int argc UNUSED_PARAM, char **argv)
719 751
720 if (G.beg_range) 752 if (G.beg_range)
721 fprintf(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range); 753 fprintf(sfp, "Range: bytes=%"OFF_FMT"u-\r\n", G.beg_range);
754
722#if ENABLE_FEATURE_WGET_LONG_OPTIONS 755#if ENABLE_FEATURE_WGET_LONG_OPTIONS
723 if (extra_headers) 756 if (extra_headers)
724 fputs(extra_headers, sfp); 757 fputs(extra_headers, sfp);
725 758
726 if (opt & WGET_OPT_POST_DATA) { 759 if (opt & WGET_OPT_POST_DATA) {
727 char *estr = URL_escape(post_data); 760 char *estr = URL_escape(post_data);
728 fprintf(sfp, "Content-Type: application/x-www-form-urlencoded\r\n"); 761 fprintf(sfp,
729 fprintf(sfp, "Content-Length: %u\r\n" "\r\n" "%s", 762 "Content-Type: application/x-www-form-urlencoded\r\n"
730 (int) strlen(estr), estr); 763 "Content-Length: %u\r\n"
731 /*fprintf(sfp, "Connection: Keep-Alive\r\n\r\n");*/ 764 "\r\n"
732 /*fprintf(sfp, "%s\r\n", estr);*/ 765 "%s",
766 (int) strlen(estr), estr
767 );
733 free(estr); 768 free(estr);
734 } else 769 } else
735#endif 770#endif
736 { /* If "Connection:" is needed, document why */ 771 {
737 fprintf(sfp, /* "Connection: close\r\n" */ "\r\n"); 772 fprintf(sfp, "\r\n");
738 } 773 }
739 774
740 fflush(sfp); 775 fflush(sfp);
diff --git a/scripts/kconfig/mconf.c b/scripts/kconfig/mconf.c
index 0c548bfc0..d292b46cc 100644
--- a/scripts/kconfig/mconf.c
+++ b/scripts/kconfig/mconf.c
@@ -256,7 +256,7 @@ search_help[] = N_(
256 " USB$ => find all CONFIG_ symbols ending with USB\n" 256 " USB$ => find all CONFIG_ symbols ending with USB\n"
257 "\n"); 257 "\n");
258 258
259static char buf[4096], *bufptr = buf; 259static char buf[4096*10], *bufptr = buf;
260static char input_buf[4096]; 260static char input_buf[4096];
261static const char filename[] = ".config"; 261static const char filename[] = ".config";
262static char *args[1024], **argptr = args; 262static char *args[1024], **argptr = args;
diff --git a/sysklogd/klogd.c b/sysklogd/klogd.c
index 0d4c2578d..db32065fb 100644
--- a/sysklogd/klogd.c
+++ b/sysklogd/klogd.c
@@ -150,12 +150,41 @@ int klogd_main(int argc UNUSED_PARAM, char **argv)
150 */ 150 */
151 klogd_open(); 151 klogd_open();
152 openlog("kernel", 0, LOG_KERN); 152 openlog("kernel", 0, LOG_KERN);
153 /*
154 * glibc problem: for some reason, glibc changes LOG_KERN to LOG_USER
155 * above. The logic behind this is that standard
156 * http://pubs.opengroup.org/onlinepubs/9699919799/functions/syslog.html
157 * says the following about openlog and syslog:
158 * "LOG_USER
159 * Messages generated by arbitrary processes.
160 * This is the default facility identifier if none is specified."
161 *
162 * I believe glibc misinterpreted this text as "if openlog's
163 * third parameter is 0 (=LOG_KERN), treat it as LOG_USER".
164 * Whereas it was meant to say "if *syslog* is called with facility
165 * 0 in its 1st parameter without prior call to openlog, then perform
166 * implicit openlog(LOG_USER)".
167 *
168 * As a result of this, eh, feature, standard klogd was forced
169 * to open-code its own openlog and syslog implementation (!).
170 *
171 * Note that prohibiting openlog(LOG_KERN) on libc level does not
172 * add any security: any process can open a socket to "/dev/log"
173 * and write a string "<0>Voila, a LOG_KERN + LOG_EMERG message"
174 *
175 * Google code search tells me there is no widespread use of
176 * openlog("foo", 0, 0), thus fixing glibc won't break userspace.
177 *
178 * The bug against glibc was filed:
179 * bugzilla.redhat.com/show_bug.cgi?id=547000
180 */
153 181
154 if (i) 182 if (i)
155 klogd_setloglevel(i); 183 klogd_setloglevel(i);
156 184
157 bb_signals(BB_FATAL_SIGS, record_signo);
158 signal(SIGHUP, SIG_IGN); 185 signal(SIGHUP, SIG_IGN);
186 /* We want klogd_read to not be restarted, thus _norestart: */
187 bb_signals_recursive_norestart(BB_FATAL_SIGS, record_signo);
159 188
160 syslog(LOG_NOTICE, "klogd started: %s", bb_banner); 189 syslog(LOG_NOTICE, "klogd started: %s", bb_banner);
161 190