summaryrefslogtreecommitdiff
path: root/execute.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-03-26 16:12:16 +0100
committerAndrew Tridgell <tridge@samba.org>2002-03-26 16:12:16 +0100
commitf171a5c9ffbcf3083dbcbccdb9a7f39442598157 (patch)
tree1a677586d0d0909baae3f46392edef3b6e4892db /execute.c
parentecb3bfc6e8b5083342ddcb35cb6f26b8f6199b2b (diff)
downloadccache-f171a5c9ffbcf3083dbcbccdb9a7f39442598157.tar.gz
delete files before creation
Diffstat (limited to 'execute.c')
-rw-r--r--execute.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/execute.c b/execute.c
index 98766fd7..4d70ce4e 100644
--- a/execute.c
+++ b/execute.c
@@ -18,6 +18,7 @@ void execute(char **argv,
if (pid == -1) fatal("Failed to fork");
if (pid == 0) {
+ unlink(path_stdout);
fd = open(path_stdout, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
if (fd == -1) {
exit(STATUS_NOCACHE);
@@ -25,6 +26,7 @@ void execute(char **argv,
dup2(fd, 1);
close(fd);
+ unlink(path_stderr);
fd = open(path_stderr, O_WRONLY|O_CREAT|O_TRUNC|O_EXCL, 0644);
if (fd == -1) {
exit(STATUS_NOCACHE);