[BusyBox-cvs] svn commit: branches/busybox_1_00_stable/busybox: archival archival/libunarchive coreutils etc...

landley at busybox.net landley at busybox.net
Sat Aug 13 00:46:01 UTC 2005


Author: landley
Date: 2005-08-12 18:46:00 -0600 (Fri, 12 Aug 2005)
New Revision: 11129

Log:
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?


Modified:
   branches/busybox_1_00_stable/busybox/archival/dpkg.c
   branches/busybox_1_00_stable/busybox/archival/libunarchive/get_header_tar.c
   branches/busybox_1_00_stable/busybox/coreutils/tail.c
   branches/busybox_1_00_stable/busybox/networking/tftp.c


Changeset:
Modified: branches/busybox_1_00_stable/busybox/archival/dpkg.c
===================================================================
--- branches/busybox_1_00_stable/busybox/archival/dpkg.c	2005-08-13 00:35:00 UTC (rev 11128)
+++ branches/busybox_1_00_stable/busybox/archival/dpkg.c	2005-08-13 00:46:00 UTC (rev 11129)
@@ -1520,6 +1520,7 @@
 {
 	ar_handle->sub_archive->action_data = data_extract_to_buffer;
 	ar_handle->sub_archive->accept = myaccept;
+	ar_handle->sub_archive->filter = filter_accept_list;
 
 	unpack_ar_archive(ar_handle);
 	close(ar_handle->src_fd);
@@ -1714,6 +1715,7 @@
 
 			if (package_num == -1) {
 				bb_error_msg("Invalid control file in %s", argv[optind]);
+                                optind++;
 				continue;
 			}
 			deb_file[deb_count]->package = (unsigned int) package_num;

Modified: branches/busybox_1_00_stable/busybox/archival/libunarchive/get_header_tar.c
===================================================================
--- branches/busybox_1_00_stable/busybox/archival/libunarchive/get_header_tar.c	2005-08-13 00:35:00 UTC (rev 11128)
+++ branches/busybox_1_00_stable/busybox/archival/libunarchive/get_header_tar.c	2005-08-13 00:46:00 UTC (rev 11129)
@@ -62,6 +62,7 @@
 	} tar;
 	long sum = 0;
 	long i;
+	static int end = 0;
 
 	/* Align header */
 	data_align(archive_handle, 512);
@@ -74,8 +75,17 @@
 
 	/* If there is no filename its an empty header */
 	if (tar.formated.name[0] == 0) {
+		if (end) {
+			/* This is the second consecutive empty header! End of archive!
+			 * Read until the end to empty the pipe from gz or bz2
+			 */
+			while (bb_full_read(archive_handle->src_fd, tar.raw, 512) == 512);
+			return(EXIT_FAILURE);
+		}
+		end = 1;
 		return(EXIT_SUCCESS);
 	}
+	end = 0;
 
 	/* Check header has valid magic, "ustar" is for the proper tar
 	 * 0's are for the old tar format

Modified: branches/busybox_1_00_stable/busybox/coreutils/tail.c
===================================================================
--- branches/busybox_1_00_stable/busybox/coreutils/tail.c	2005-08-13 00:35:00 UTC (rev 11128)
+++ branches/busybox_1_00_stable/busybox/coreutils/tail.c	2005-08-13 00:46:00 UTC (rev 11129)
@@ -79,7 +79,13 @@
 static ssize_t tail_read(int fd, char *buf, size_t count)
 {
 	ssize_t r;
+	off_t current,end;
+	struct stat sbuf;
 
+	end = current = lseek(fd, 0, SEEK_CUR);
+	if (!fstat(fd, &sbuf))
+		end = sbuf.st_size;
+	lseek(fd, end < current ? 0 : current, SEEK_SET);
 	if ((r = safe_read(fd, buf, count)) < 0) {
 		bb_perror_msg("read");
 		status = EXIT_FAILURE;

Modified: branches/busybox_1_00_stable/busybox/networking/tftp.c
===================================================================
--- branches/busybox_1_00_stable/busybox/networking/tftp.c	2005-08-13 00:35:00 UTC (rev 11128)
+++ branches/busybox_1_00_stable/busybox/networking/tftp.c	2005-08-13 00:46:00 UTC (rev 11129)
@@ -320,7 +320,7 @@
 			FD_ZERO(&rfds);
 			FD_SET(socketfd, &rfds);
 
-			switch (select(FD_SETSIZE, &rfds, NULL, NULL, &tv)) {
+			switch (select(socketfd + 1, &rfds, NULL, NULL, &tv)) {
 			case 1:
 				len = recvfrom(socketfd, buf, tftp_bufsize, 0,
 						(struct sockaddr *) &from, &fromlen);
@@ -463,6 +463,11 @@
 				--block_nr;
 				opcode = TFTP_ACK;
 				continue;
+			} else if (tmp + 1 == block_nr) {
+				/* Server lost our TFTP_ACK.  Resend it */
+				block_nr = tmp;
+				opcode = TFTP_ACK;
+				continue;
 			}
 		}
 




More information about the busybox-cvs mailing list