From: Matt Kraai Date: Fri, 1 Sep 2000 02:50:48 +0000 (-0000) Subject: Don't unlink files if we are extracting to stdout. X-Git-Tag: 0_47~128 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=f446297afd6b1d0c2558038f198a929082f820f7;p=oweals%2Fbusybox.git Don't unlink files if we are extracting to stdout. --- diff --git a/archival/tar.c b/archival/tar.c index cab53aa10..597e9b80d 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. */ diff --git a/tar.c b/tar.c index cab53aa10..597e9b80d 100644 --- a/tar.c +++ b/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. */