[BusyBox] [patch] make bunzip2 command line happy, plus typo fixes.

Rob Landley rob at landley.net
Wed Oct 29 02:37:59 UTC 2003


I looked at tar.  It's not really a whole lot of fun, and doesn't look like a
simple three line patch.  (What was wrong with reading from a pipe again?)

This makes the bunzip2 command line thingy happy with "0 for no error,
nonzero for error" return code of the new bunzip engine.  (There's a reason
I renamed the source file: it's a completely different engine.  But I guess
that would have given CVS fits, so...) Tar I probably won't have time to
tackle until at least this weekend...

diff -ru busybox/archival/bunzip2.c busybox2/archival/bunzip2.c
--- busybox/archival/bunzip2.c	2003-03-19 03:11:21.000000000 -0600
+++ busybox2/archival/bunzip2.c	2003-10-28 20:17:45.857396296 -0600
@@ -83,17 +83,9 @@
 		dst_fd = bb_xopen(save_name, O_WRONLY | O_CREAT);
 	}
 
-	if (uncompressStream(src_fd, dst_fd)) {
-		if (!(flags & bunzip_to_stdout)) {
-			delete_name = argv[optind];
-		}
-		status = EXIT_SUCCESS;
-	} else {
-		if (!(flags & bunzip_to_stdout)) {
-			delete_name = save_name;
-		}
-		status = EXIT_FAILURE;
-	}
+	status=uncompressStream(src_fd, dst_fd);
+	if(!(flags & bunzip_to_stdout))
+		delete_name=status ? save_name : argv[optind];
 
 	if ((delete_name) && (unlink(delete_name) < 0)) {
 		bb_error_msg_and_die("Couldn't remove %s", delete_name);
diff -ru busybox/include/unarchive.h busybox2/include/unarchive.h
--- busybox/include/unarchive.h	2003-08-28 14:12:23.000000000 -0500
+++ busybox2/include/unarchive.h	2003-10-28 20:27:31.856310920 -0600
@@ -35,7 +35,7 @@
 	/* process the header component, e.g. tar -t */
 	void (*action_header)(const file_header_t *);
 
-	/* process the data componenet, e.g. extract to filesystem */
+	/* process the data component, e.g. extract to filesystem */
 	void (*action_data)(struct archive_handle_s *);
 	
 	/* How to process any sub archive, e.g. get_header_tar_gz */
@@ -56,7 +56,7 @@
 	/* Function that skips data: read_by_char or read_by_skip */
 	void (*seek)(const struct archive_handle_s *archive_handle, const unsigned int amount);
 
-	/* Temperary storage */
+	/* Temporary storage */
 	char *buffer;
 
 	/* Misc. stuff */




More information about the busybox mailing list