[BusyBox-cvs] busybox/archival tar.c,1.169,1.170

Glenn McGrath bug1 at busybox.net
Mon Apr 21 10:07:52 UTC 2003


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

Modified Files:
	tar.c 
Log Message:
unlink() an existing file, before opening it, simply truncating can 
cause nasty problems if overwriting glibc, spotted by waldi.


Index: tar.c
===================================================================
RCS file: /var/cvs/busybox/archival/tar.c,v
retrieving revision 1.169
retrieving revision 1.170
diff -u -d -r1.169 -r1.170
--- tar.c	19 Mar 2003 09:11:22 -0000	1.169
+++ tar.c	21 Apr 2003 10:07:48 -0000	1.170
@@ -472,7 +472,8 @@
 		tbInfo.tarFd = fileno(stdout);
 		tbInfo.verboseFlag = verboseFlag ? 2 : 0;
 	} else {
-		tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_TRUNC, 0644);
+		unlink(tarName);
+		tbInfo.tarFd = open(tarName, O_WRONLY | O_CREAT | O_EXCL, 0644);
 		tbInfo.verboseFlag = verboseFlag ? 1 : 0;
 	}
 



More information about the busybox-cvs mailing list