[BusyBox-cvs] busybox/archival tar.c,1.181,1.182

Glenn McGrath bug1 at busybox.net
Thu Nov 20 09:06:15 UTC 2003


Update of /var/cvs/busybox/archival
In directory winder:/tmp/cvs-serv23034/archival

Modified Files:
	tar.c 
Log Message:
Check there are files to add the archive before removing a specified 
tar file.


Index: tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/tar.c,v
retrieving revision 1.181
retrieving revision 1.182
diff -u -d -r1.181 -r1.182
--- tar.c	18 Nov 2003 21:37:50 -0000	1.181
+++ tar.c	20 Nov 2003 09:06:10 -0000	1.182
@@ -462,11 +462,6 @@
 
 	tbInfo.hlInfoHead = NULL;
 
-	/* Make sure there is at least one file to tar up.  */
-	if (include == NULL) {
-		bb_error_msg_and_die("Cowardly refusing to create an empty archive");
-	}
-
 	fchmod(tar_fd, 0644);
 	tbInfo.tarFd = tar_fd;
 	tbInfo.verboseFlag = verboseFlag;
@@ -748,6 +743,10 @@
 
 #ifdef CONFIG_FEATURE_TAR_CREATE
 		if (ctx_flag == CTX_CREATE) {
+			/* Make sure there is at least one file to tar up.  */
+			if (tar_handle->accept == NULL) {
+				bb_error_msg_and_die("Cowardly refusing to create an empty archive");
+			}
 			tar_stream = stdout;
 			flags = O_WRONLY | O_CREAT | O_EXCL;
 			unlink(tar_filename);




More information about the busybox-cvs mailing list