[BusyBox] BB tar -C does not work as GNU tar -C

Martin Volf mv at inv.cz
Tue Feb 11 06:36:07 UTC 2003


Hello,

The following patch for archival/tar.c is needed to make busybox v0.61.pre tar -C work as GNU tar -C. Without the patch the -C option works only for extracting.

--- tar.c.orig	2002-12-08 13:24:04.000000000 +0100
+++ tar.c	2003-02-11 14:13:00.000000000 +0100
@@ -694,6 +694,10 @@
 		}
 	}
 
+	if ((base_dir) && (chdir(base_dir))) {
+		perror_msg_and_die("Couldnt chdir");
+	}
+
 	/* Check one and only one context option was given */
 	if ((ctx_flag != CTX_CREATE) && (ctx_flag != CTX_TEST) && (ctx_flag != CTX_EXTRACT)) {
 		show_usage();
@@ -743,10 +747,6 @@
 			tar_handle->src_fd = xopen(tar_filename, O_RDONLY);
 		}
 
-		if ((base_dir) && (chdir(base_dir))) {
-			perror_msg_and_die("Couldnt chdir");
-		}
-
 		while (get_header_ptr(tar_handle) == EXIT_SUCCESS);
 
 		/* Ckeck that every file that should have been extracted was */

-- 
Martin Volf



More information about the busybox mailing list