summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorMatt Kraai2000-09-01 02:50:48 +0000
committerMatt Kraai2000-09-01 02:50:48 +0000
commitf446297afd6b1d0c2558038f198a929082f820f7 (patch)
tree6d6efc8106121e2cb8f88363ff5f521878db7910 /archival/tar.c
parente99674a70fa444e2b6e5d4db9e66113c7df76508 (diff)
downloadbusybox-f446297afd6b1d0c2558038f198a929082f820f7.zip
busybox-f446297afd6b1d0c2558038f198a929082f820f7.tar.gz
Don't unlink files if we are extracting to stdout.
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/archival/tar.c b/archival/tar.c
index cab53aa..597e9b8 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -600,9 +600,9 @@ static int readTarFile(const char* tarName, int extractFlag, int listFlag,
printf("\n");
}
- /* Remove any clutter lying in our way */
- if (extractFlag == TRUE) /* .. but only if we are extracting (as */
- unlink( header.name); /* opposed to listing) (rob@sysgo.de) */
+ /* Remove files if we would overwrite them */
+ if (extractFlag == TRUE && tostdOut == FALSE)
+ unlink(header.name);
/* If we got here, we can be certain we have a legitimate
* header to work with. So work with it. */