diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-28 17:48:15 +0200 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-10-28 17:48:15 +0200 |
commit | 1e98f3741c5a844c1d3d7966f20cd09dded05d0d (patch) | |
tree | 6044a3e180389e63c55173f5018bf2ddaa195cd6 | |
parent | ed058016bf8fc98271de2e58bfb650de9e9d304d (diff) | |
download | busybox-w32-1e98f3741c5a844c1d3d7966f20cd09dded05d0d.tar.gz busybox-w32-1e98f3741c5a844c1d3d7966f20cd09dded05d0d.tar.bz2 busybox-w32-1e98f3741c5a844c1d3d7966f20cd09dded05d0d.zip |
Apply post-1.19.2 patches, bump version to 1.19.31_19_3
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | Makefile | 2 | ||||
-rw-r--r-- | applets/applet_tables.c | 9 | ||||
-rw-r--r-- | coreutils/tail.c | 6 | ||||
-rw-r--r-- | include/platform.h | 2 | ||||
-rw-r--r-- | loginutils/chpasswd.c | 17 | ||||
-rw-r--r-- | miscutils/crond.c | 3 | ||||
-rw-r--r-- | networking/inetd.c | 14 | ||||
-rw-r--r-- | networking/tftp.c | 3 | ||||
-rw-r--r-- | sysklogd/syslogd.c | 12 | ||||
-rwxr-xr-x | testsuite/tail.tests | 8 |
10 files changed, 56 insertions, 20 deletions
@@ -1,6 +1,6 @@ | |||
1 | VERSION = 1 | 1 | VERSION = 1 |
2 | PATCHLEVEL = 19 | 2 | PATCHLEVEL = 19 |
3 | SUBLEVEL = 2 | 3 | SUBLEVEL = 3 |
4 | EXTRAVERSION = | 4 | EXTRAVERSION = |
5 | NAME = Unnamed | 5 | NAME = Unnamed |
6 | 6 | ||
diff --git a/applets/applet_tables.c b/applets/applet_tables.c index 3859d7326..a47574737 100644 --- a/applets/applet_tables.c +++ b/applets/applet_tables.c | |||
@@ -80,8 +80,15 @@ int main(int argc, char **argv) | |||
80 | 80 | ||
81 | printf("#define NUM_APPLETS %u\n", NUM_APPLETS); | 81 | printf("#define NUM_APPLETS %u\n", NUM_APPLETS); |
82 | if (NUM_APPLETS == 1) { | 82 | if (NUM_APPLETS == 1) { |
83 | char *dash_to_underscore, *p; | ||
83 | printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name); | 84 | printf("#define SINGLE_APPLET_STR \"%s\"\n", applets[0].name); |
84 | printf("#define SINGLE_APPLET_MAIN %s_main\n", applets[0].name); | 85 | /* Example: "ether-wake" -> "ether_wake" */ |
86 | p = dash_to_underscore = strdup(applets[0].name); | ||
87 | p--; | ||
88 | while (*++p) | ||
89 | if (*p == '-') | ||
90 | *p = '_'; | ||
91 | printf("#define SINGLE_APPLET_MAIN %s_main\n", dash_to_underscore); | ||
85 | } | 92 | } |
86 | printf("\n"); | 93 | printf("\n"); |
87 | 94 | ||
diff --git a/coreutils/tail.c b/coreutils/tail.c index 454c25936..43cecbd97 100644 --- a/coreutils/tail.c +++ b/coreutils/tail.c | |||
@@ -203,7 +203,7 @@ int tail_main(int argc, char **argv) | |||
203 | int fd = fds[i]; | 203 | int fd = fds[i]; |
204 | 204 | ||
205 | if (ENABLE_FEATURE_FANCY_TAIL && fd < 0) | 205 | if (ENABLE_FEATURE_FANCY_TAIL && fd < 0) |
206 | continue; /* may happen with -E */ | 206 | continue; /* may happen with -F */ |
207 | 207 | ||
208 | if (nfiles > header_threshhold) { | 208 | if (nfiles > header_threshhold) { |
209 | tail_xprint_header(fmt, argv[i]); | 209 | tail_xprint_header(fmt, argv[i]); |
@@ -252,14 +252,14 @@ int tail_main(int argc, char **argv) | |||
252 | * Used only by +N code ("start from Nth", 1-based): */ | 252 | * Used only by +N code ("start from Nth", 1-based): */ |
253 | seen = 1; | 253 | seen = 1; |
254 | newlines_seen = 0; | 254 | newlines_seen = 0; |
255 | while ((nread = tail_read(fd, buf, tailbufsize-taillen)) > 0) { | 255 | while ((nread = tail_read(fd, buf, tailbufsize - taillen)) > 0) { |
256 | if (G.from_top) { | 256 | if (G.from_top) { |
257 | int nwrite = nread; | 257 | int nwrite = nread; |
258 | if (seen < count) { | 258 | if (seen < count) { |
259 | /* We need to skip a few more bytes/lines */ | 259 | /* We need to skip a few more bytes/lines */ |
260 | if (COUNT_BYTES) { | 260 | if (COUNT_BYTES) { |
261 | nwrite -= (count - seen); | 261 | nwrite -= (count - seen); |
262 | seen = count; | 262 | seen += nread; |
263 | } else { | 263 | } else { |
264 | char *s = buf; | 264 | char *s = buf; |
265 | do { | 265 | do { |
diff --git a/include/platform.h b/include/platform.h index 826a4c497..aa1bc331b 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -433,7 +433,7 @@ typedef unsigned smalluint; | |||
433 | # undef HAVE_STPCPY | 433 | # undef HAVE_STPCPY |
434 | #endif | 434 | #endif |
435 | 435 | ||
436 | #if defined(ANDROID) | 436 | #if defined(ANDROID) || defined(__ANDROID__) |
437 | # undef HAVE_DPRINTF | 437 | # undef HAVE_DPRINTF |
438 | # undef HAVE_GETLINE | 438 | # undef HAVE_GETLINE |
439 | # undef HAVE_STPCPY | 439 | # undef HAVE_STPCPY |
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c index 2262b792a..b7df57e5d 100644 --- a/loginutils/chpasswd.c +++ b/loginutils/chpasswd.c | |||
@@ -33,9 +33,8 @@ static const char chpasswd_longopts[] ALIGN1 = | |||
33 | int chpasswd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; | 33 | int chpasswd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; |
34 | int chpasswd_main(int argc UNUSED_PARAM, char **argv) | 34 | int chpasswd_main(int argc UNUSED_PARAM, char **argv) |
35 | { | 35 | { |
36 | char *name, *pass; | 36 | char *name; |
37 | char salt[sizeof("$N$XXXXXXXX")]; | 37 | int opt; |
38 | int opt, rc; | ||
39 | 38 | ||
40 | if (getuid() != 0) | 39 | if (getuid() != 0) |
41 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); | 40 | bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); |
@@ -45,6 +44,10 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
45 | opt = getopt32(argv, "em"); | 44 | opt = getopt32(argv, "em"); |
46 | 45 | ||
47 | while ((name = xmalloc_fgetline(stdin)) != NULL) { | 46 | while ((name = xmalloc_fgetline(stdin)) != NULL) { |
47 | char *free_me; | ||
48 | char *pass; | ||
49 | int rc; | ||
50 | |||
48 | pass = strchr(name, ':'); | 51 | pass = strchr(name, ':'); |
49 | if (!pass) | 52 | if (!pass) |
50 | bb_error_msg_and_die("missing new password"); | 53 | bb_error_msg_and_die("missing new password"); |
@@ -52,7 +55,10 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
52 | 55 | ||
53 | xuname2uid(name); /* dies if there is no such user */ | 56 | xuname2uid(name); /* dies if there is no such user */ |
54 | 57 | ||
58 | free_me = NULL; | ||
55 | if (!(opt & OPT_ENC)) { | 59 | if (!(opt & OPT_ENC)) { |
60 | char salt[sizeof("$N$XXXXXXXX")]; | ||
61 | |||
56 | crypt_make_salt(salt, 1); | 62 | crypt_make_salt(salt, 1); |
57 | if (opt & OPT_MD5) { | 63 | if (opt & OPT_MD5) { |
58 | salt[0] = '$'; | 64 | salt[0] = '$'; |
@@ -60,7 +66,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
60 | salt[2] = '$'; | 66 | salt[2] = '$'; |
61 | crypt_make_salt(salt + 3, 4); | 67 | crypt_make_salt(salt + 3, 4); |
62 | } | 68 | } |
63 | pass = pw_encrypt(pass, salt, 0); | 69 | free_me = pass = pw_encrypt(pass, salt, 0); |
64 | } | 70 | } |
65 | 71 | ||
66 | /* This is rather complex: if user is not found in /etc/shadow, | 72 | /* This is rather complex: if user is not found in /etc/shadow, |
@@ -81,8 +87,7 @@ int chpasswd_main(int argc UNUSED_PARAM, char **argv) | |||
81 | bb_info_msg("Password for '%s' changed", name); | 87 | bb_info_msg("Password for '%s' changed", name); |
82 | logmode = LOGMODE_STDIO; | 88 | logmode = LOGMODE_STDIO; |
83 | free(name); | 89 | free(name); |
84 | if (!(opt & OPT_ENC)) | 90 | free(free_me); |
85 | free(pass); | ||
86 | } | 91 | } |
87 | return EXIT_SUCCESS; | 92 | return EXIT_SUCCESS; |
88 | } | 93 | } |
diff --git a/miscutils/crond.c b/miscutils/crond.c index 014016fb6..a0b73c774 100644 --- a/miscutils/crond.c +++ b/miscutils/crond.c | |||
@@ -861,7 +861,8 @@ int crond_main(int argc UNUSED_PARAM, char **argv) | |||
861 | 861 | ||
862 | /* "-b after -f is ignored", and so on for every pair a-b */ | 862 | /* "-b after -f is ignored", and so on for every pair a-b */ |
863 | opt_complementary = "f-b:b-f:S-L:L-S" IF_FEATURE_CROND_D(":d-l") | 863 | opt_complementary = "f-b:b-f:S-L:L-S" IF_FEATURE_CROND_D(":d-l") |
864 | ":l+:d+"; /* -l and -d have numeric param */ | 864 | /* -l and -d have numeric param */ |
865 | ":l+" IF_FEATURE_CROND_D(":d+"); | ||
865 | opts = getopt32(argv, "l:L:fbSc:" IF_FEATURE_CROND_D("d:"), | 866 | opts = getopt32(argv, "l:L:fbSc:" IF_FEATURE_CROND_D("d:"), |
866 | &G.log_level, &G.log_filename, &G.crontab_dir_name | 867 | &G.log_level, &G.log_filename, &G.crontab_dir_name |
867 | IF_FEATURE_CROND_D(,&G.log_level)); | 868 | IF_FEATURE_CROND_D(,&G.log_level)); |
diff --git a/networking/inetd.c b/networking/inetd.c index 873fd9528..05ad8c792 100644 --- a/networking/inetd.c +++ b/networking/inetd.c | |||
@@ -1278,6 +1278,7 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1278 | sep->se_count = 0; | 1278 | sep->se_count = 0; |
1279 | rearm_alarm(); /* will revive it in RETRYTIME sec */ | 1279 | rearm_alarm(); /* will revive it in RETRYTIME sec */ |
1280 | restore_sigmask(&omask); | 1280 | restore_sigmask(&omask); |
1281 | maybe_close(new_udp_fd); | ||
1281 | maybe_close(accepted_fd); | 1282 | maybe_close(accepted_fd); |
1282 | continue; /* -> check next fd in fd set */ | 1283 | continue; /* -> check next fd in fd set */ |
1283 | } | 1284 | } |
@@ -1298,17 +1299,18 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1298 | bb_perror_msg("vfork"+1); | 1299 | bb_perror_msg("vfork"+1); |
1299 | sleep(1); | 1300 | sleep(1); |
1300 | restore_sigmask(&omask); | 1301 | restore_sigmask(&omask); |
1302 | maybe_close(new_udp_fd); | ||
1301 | maybe_close(accepted_fd); | 1303 | maybe_close(accepted_fd); |
1302 | continue; /* -> check next fd in fd set */ | 1304 | continue; /* -> check next fd in fd set */ |
1303 | } | 1305 | } |
1304 | if (pid == 0) | 1306 | if (pid == 0) |
1305 | pid--; /* -1: "we did fork and we are child" */ | 1307 | pid--; /* -1: "we did fork and we are child" */ |
1306 | } | 1308 | } |
1307 | /* if pid == 0 here, we never forked */ | 1309 | /* if pid == 0 here, we didn't fork */ |
1308 | 1310 | ||
1309 | if (pid > 0) { /* parent */ | 1311 | if (pid > 0) { /* parent */ |
1310 | if (sep->se_wait) { | 1312 | if (sep->se_wait) { |
1311 | /* tcp wait: we passed listening socket to child, | 1313 | /* wait: we passed socket to child, |
1312 | * will wait for child to terminate */ | 1314 | * will wait for child to terminate */ |
1313 | sep->se_wait = pid; | 1315 | sep->se_wait = pid; |
1314 | remove_fd_from_set(sep->se_fd); | 1316 | remove_fd_from_set(sep->se_fd); |
@@ -1345,9 +1347,13 @@ int inetd_main(int argc UNUSED_PARAM, char **argv) | |||
1345 | setsid(); | 1347 | setsid(); |
1346 | /* "nowait" udp */ | 1348 | /* "nowait" udp */ |
1347 | if (new_udp_fd >= 0) { | 1349 | if (new_udp_fd >= 0) { |
1348 | len_and_sockaddr *lsa = xzalloc_lsa(sep->se_family); | 1350 | len_and_sockaddr *lsa; |
1351 | int r; | ||
1352 | |||
1353 | close(new_udp_fd); | ||
1354 | lsa = xzalloc_lsa(sep->se_family); | ||
1349 | /* peek at the packet and remember peer addr */ | 1355 | /* peek at the packet and remember peer addr */ |
1350 | int r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, | 1356 | r = recvfrom(ctrl, NULL, 0, MSG_PEEK|MSG_DONTWAIT, |
1351 | &lsa->u.sa, &lsa->len); | 1357 | &lsa->u.sa, &lsa->len); |
1352 | if (r < 0) | 1358 | if (r < 0) |
1353 | goto do_exit1; | 1359 | goto do_exit1; |
diff --git a/networking/tftp.c b/networking/tftp.c index 17485a527..043b879af 100644 --- a/networking/tftp.c +++ b/networking/tftp.c | |||
@@ -813,7 +813,8 @@ int tftpd_main(int argc UNUSED_PARAM, char **argv) | |||
813 | goto err; | 813 | goto err; |
814 | } | 814 | } |
815 | mode = local_file + strlen(local_file) + 1; | 815 | mode = local_file + strlen(local_file) + 1; |
816 | if (mode >= block_buf + result || strcmp(mode, "octet") != 0) { | 816 | /* RFC 1350 says mode string is case independent */ |
817 | if (mode >= block_buf + result || strcasecmp(mode, "octet") != 0) { | ||
817 | goto err; | 818 | goto err; |
818 | } | 819 | } |
819 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE | 820 | # if ENABLE_FEATURE_TFTP_BLOCKSIZE |
diff --git a/sysklogd/syslogd.c b/sysklogd/syslogd.c index 2f0ca6ac5..fc380d9f9 100644 --- a/sysklogd/syslogd.c +++ b/sysklogd/syslogd.c | |||
@@ -278,7 +278,7 @@ static void parse_syslogdcfg(const char *file) | |||
278 | parser_t *parser; | 278 | parser_t *parser; |
279 | 279 | ||
280 | parser = config_open2(file ? file : "/etc/syslog.conf", | 280 | parser = config_open2(file ? file : "/etc/syslog.conf", |
281 | file ? xfopen_for_read : fopen_or_warn_stdin); | 281 | file ? xfopen_for_read : fopen_for_read); |
282 | if (!parser) | 282 | if (!parser) |
283 | /* didn't find default /etc/syslog.conf */ | 283 | /* didn't find default /etc/syslog.conf */ |
284 | /* proceed as if we built busybox without config support */ | 284 | /* proceed as if we built busybox without config support */ |
@@ -594,6 +594,14 @@ static void log_locally(time_t now, char *msg, logFile_t *log_file) | |||
594 | } | 594 | } |
595 | /* newFile == "f.0" now */ | 595 | /* newFile == "f.0" now */ |
596 | rename(log_file->path, newFile); | 596 | rename(log_file->path, newFile); |
597 | /* Incredibly, if F and F.0 are hardlinks, POSIX | ||
598 | * _demands_ that rename returns 0 but does not | ||
599 | * remove F!!! | ||
600 | * (hardlinked F/F.0 pair was observed after | ||
601 | * power failure during rename()). | ||
602 | * Ensure old file is gone: | ||
603 | */ | ||
604 | unlink(log_file->path); | ||
597 | #ifdef SYSLOGD_WRLOCK | 605 | #ifdef SYSLOGD_WRLOCK |
598 | fl.l_type = F_UNLCK; | 606 | fl.l_type = F_UNLCK; |
599 | fcntl(log_file->fd, F_SETLKW, &fl); | 607 | fcntl(log_file->fd, F_SETLKW, &fl); |
@@ -678,7 +686,7 @@ static void timestamp_and_log(int pri, char *msg, int len) | |||
678 | if (LOG_PRI(pri) < G.logLevel) { | 686 | if (LOG_PRI(pri) < G.logLevel) { |
679 | #if ENABLE_FEATURE_IPC_SYSLOG | 687 | #if ENABLE_FEATURE_IPC_SYSLOG |
680 | if ((option_mask32 & OPT_circularlog) && G.shbuf) { | 688 | if ((option_mask32 & OPT_circularlog) && G.shbuf) { |
681 | log_to_shmem(msg); | 689 | log_to_shmem(G.printbuf); |
682 | return; | 690 | return; |
683 | } | 691 | } |
684 | #endif | 692 | #endif |
diff --git a/testsuite/tail.tests b/testsuite/tail.tests index 7140da262..305a83b15 100755 --- a/testsuite/tail.tests +++ b/testsuite/tail.tests | |||
@@ -14,4 +14,12 @@ testing "tail: +N with N > file length" \ | |||
14 | "0\n" \ | 14 | "0\n" \ |
15 | "" "qw" | 15 | "" "qw" |
16 | 16 | ||
17 | testing "tail: -c +N with largish N" \ | ||
18 | " | ||
19 | dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8200 | wc -c; | ||
20 | dd if=/dev/zero bs=16k count=1 2>/dev/null | tail -c +8208 | wc -c; | ||
21 | " \ | ||
22 | "8185\n8177\n" \ | ||
23 | "" "" | ||
24 | |||
17 | exit $FAILCOUNT | 25 | exit $FAILCOUNT |