aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-08-13 00:46:00 +0000
committerRob Landley <rob@landley.net>2005-08-13 00:46:00 +0000
commit6022fc8723c4bfaf055011db33f69565fa0c82b1 (patch)
treef37b984e249247f2bdf6679e8b01158afcb56e16
parentfc455b2101edbf97331384831de2989ce9cdb731 (diff)
downloadbusybox-w32-6022fc8723c4bfaf055011db33f69565fa0c82b1.tar.gz
busybox-w32-6022fc8723c4bfaf055011db33f69565fa0c82b1.tar.bz2
busybox-w32-6022fc8723c4bfaf055011db33f69565fa0c82b1.zip
Backport:
10882 tar fix 10884, 10920, 11128 tail fixes 10885 tftp -g fix 10900 dpkg fix (script support) And I guess 10918 isn't relevant?
-rw-r--r--busybox/archival/dpkg.c2
-rw-r--r--busybox/archival/libunarchive/get_header_tar.c10
-rw-r--r--busybox/coreutils/tail.c6
-rw-r--r--busybox/networking/tftp.c7
4 files changed, 24 insertions, 1 deletions
diff --git a/busybox/archival/dpkg.c b/busybox/archival/dpkg.c
index d3b56e398..6a81029cc 100644
--- a/busybox/archival/dpkg.c
+++ b/busybox/archival/dpkg.c
@@ -1520,6 +1520,7 @@ static char *deb_extract_control_file_to_buffer(archive_handle_t *ar_handle, lli
1520{ 1520{
1521 ar_handle->sub_archive->action_data = data_extract_to_buffer; 1521 ar_handle->sub_archive->action_data = data_extract_to_buffer;
1522 ar_handle->sub_archive->accept = myaccept; 1522 ar_handle->sub_archive->accept = myaccept;
1523 ar_handle->sub_archive->filter = filter_accept_list;
1523 1524
1524 unpack_ar_archive(ar_handle); 1525 unpack_ar_archive(ar_handle);
1525 close(ar_handle->src_fd); 1526 close(ar_handle->src_fd);
@@ -1714,6 +1715,7 @@ int dpkg_main(int argc, char **argv)
1714 1715
1715 if (package_num == -1) { 1716 if (package_num == -1) {
1716 bb_error_msg("Invalid control file in %s", argv[optind]); 1717 bb_error_msg("Invalid control file in %s", argv[optind]);
1718 optind++;
1717 continue; 1719 continue;
1718 } 1720 }
1719 deb_file[deb_count]->package = (unsigned int) package_num; 1721 deb_file[deb_count]->package = (unsigned int) package_num;
diff --git a/busybox/archival/libunarchive/get_header_tar.c b/busybox/archival/libunarchive/get_header_tar.c
index 1ad9ac5e5..513909d5f 100644
--- a/busybox/archival/libunarchive/get_header_tar.c
+++ b/busybox/archival/libunarchive/get_header_tar.c
@@ -62,6 +62,7 @@ extern char get_header_tar(archive_handle_t *archive_handle)
62 } tar; 62 } tar;
63 long sum = 0; 63 long sum = 0;
64 long i; 64 long i;
65 static int end = 0;
65 66
66 /* Align header */ 67 /* Align header */
67 data_align(archive_handle, 512); 68 data_align(archive_handle, 512);
@@ -74,8 +75,17 @@ extern char get_header_tar(archive_handle_t *archive_handle)
74 75
75 /* If there is no filename its an empty header */ 76 /* If there is no filename its an empty header */
76 if (tar.formated.name[0] == 0) { 77 if (tar.formated.name[0] == 0) {
78 if (end) {
79 /* This is the second consecutive empty header! End of archive!
80 * Read until the end to empty the pipe from gz or bz2
81 */
82 while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
83 return(EXIT_FAILURE);
84 }
85 end = 1;
77 return(EXIT_SUCCESS); 86 return(EXIT_SUCCESS);
78 } 87 }
88 end = 0;
79 89
80 /* Check header has valid magic, "ustar" is for the proper tar 90 /* Check header has valid magic, "ustar" is for the proper tar
81 * 0's are for the old tar format 91 * 0's are for the old tar format
diff --git a/busybox/coreutils/tail.c b/busybox/coreutils/tail.c
index e3f89d2ee..1db1e2b0f 100644
--- a/busybox/coreutils/tail.c
+++ b/busybox/coreutils/tail.c
@@ -79,7 +79,13 @@ static void tail_xbb_full_write(const char *buf, size_t len)
79static ssize_t tail_read(int fd, char *buf, size_t count) 79static ssize_t tail_read(int fd, char *buf, size_t count)
80{ 80{
81 ssize_t r; 81 ssize_t r;
82 off_t current,end;
83 struct stat sbuf;
82 84
85 end = current = lseek(fd, 0, SEEK_CUR);
86 if (!fstat(fd, &sbuf))
87 end = sbuf.st_size;
88 lseek(fd, end < current ? 0 : current, SEEK_SET);
83 if ((r = safe_read(fd, buf, count)) < 0) { 89 if ((r = safe_read(fd, buf, count)) < 0) {
84 bb_perror_msg("read"); 90 bb_perror_msg("read");
85 status = EXIT_FAILURE; 91 status = EXIT_FAILURE;
diff --git a/busybox/networking/tftp.c b/busybox/networking/tftp.c
index 47fc3879e..bc57f1024 100644
--- a/busybox/networking/tftp.c
+++ b/busybox/networking/tftp.c
@@ -320,7 +320,7 @@ static inline int tftp(const int cmd, const struct hostent *host,
320 FD_ZERO(&rfds); 320 FD_ZERO(&rfds);
321 FD_SET(socketfd, &rfds); 321 FD_SET(socketfd, &rfds);
322 322
323 switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) { 323 switch (select(socketfd + 1, &rfds, NULL, NULL, &tv)) {
324 case 1: 324 case 1:
325 len = recvfrom(socketfd, buf, tftp_bufsize, 0, 325 len = recvfrom(socketfd, buf, tftp_bufsize, 0,
326 (struct sockaddr *) &from, &fromlen); 326 (struct sockaddr *) &from, &fromlen);
@@ -463,6 +463,11 @@ static inline int tftp(const int cmd, const struct hostent *host,
463 --block_nr; 463 --block_nr;
464 opcode = TFTP_ACK; 464 opcode = TFTP_ACK;
465 continue; 465 continue;
466 } else if (tmp + 1 == block_nr) {
467 /* Server lost our TFTP_ACK. Resend it */
468 block_nr = tmp;
469 opcode = TFTP_ACK;
470 continue;
466 } 471 }
467 } 472 }
468 473