projects
/
platform
/
upstream
/
busybox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
6f9a0d4
)
unlink() an existing file, before opening it, simply truncating can
author
Glenn L McGrath
<bug1@ihug.co.nz>
Mon, 21 Apr 2003 10:07:48 +0000
(10:07 -0000)
committer
Glenn L McGrath
<bug1@ihug.co.nz>
Mon, 21 Apr 2003 10:07:48 +0000
(10:07 -0000)
cause nasty problems if overwriting glibc, spotted by waldi.
archival/tar.c
patch
|
blob
|
history
diff --git
a/archival/tar.c
b/archival/tar.c
index
c39d578
..
23af9ff
100644
(file)
--- a/
archival/tar.c
+++ b/
archival/tar.c
@@
-472,7
+472,8
@@
static inline int writeTarFile(const char *tarName, const int verboseFlag,
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;
}