aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-13 15:39:30 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-05-13 15:39:30 +0000
commitc17b47e96944cbab5c9c05b6e3eccf6086b753de (patch)
tree290ce540a96269c74ffc1a501dabc1789547e676 /tar.c
parent7c71cbc186a30130e57512f35613a4422850fc6b (diff)
downloadbusybox-w32-c17b47e96944cbab5c9c05b6e3eccf6086b753de.tar.gz
busybox-w32-c17b47e96944cbab5c9c05b6e3eccf6086b753de.tar.bz2
busybox-w32-c17b47e96944cbab5c9c05b6e3eccf6086b753de.zip
Do not ever change permissions on existing directories, only
on directories we created while extracting a tarball. Fix based on bug report and patch from Konstantin Boldyshev <konst@linuxassembly.org> -Erik git-svn-id: svn://busybox.net/trunk/busybox@2632 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'tar.c')
-rw-r--r--tar.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/tar.c b/tar.c
index 135bfd186..6af16f4bd 100644
--- a/tar.c
+++ b/tar.c
@@ -382,6 +382,7 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
382static int 382static int
383tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) 383tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
384{ 384{
385 int result;
385 386
386 if (extractFlag==FALSE || tostdoutFlag==TRUE) 387 if (extractFlag==FALSE || tostdoutFlag==TRUE)
387 return( TRUE); 388 return( TRUE);
@@ -393,12 +394,15 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
393 /* make the final component, just in case it was 394 /* make the final component, just in case it was
394 * omitted by create_path() (which will skip the 395 * omitted by create_path() (which will skip the
395 * directory if it doesn't have a terminating '/') */ 396 * directory if it doesn't have a terminating '/') */
396 if (mkdir(header->name, header->mode) < 0 && errno != EEXIST) { 397 result = mkdir(header->name, header->mode);
398 /* Don't fix permissions on pre-existing directories */
399 if (result == 0) {
400 fixUpPermissions(header);
401 } else if (result < 0 && errno != EEXIST) {
397 perror_msg("%s", header->name); 402 perror_msg("%s", header->name);
398 return FALSE; 403 return FALSE;
399 } 404 }
400 405
401 fixUpPermissions(header);
402 return( TRUE); 406 return( TRUE);
403} 407}
404 408