summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Andersen2000-06-09 20:51:50 +0000
committerEric Andersen2000-06-09 20:51:50 +0000
commit0c6a970eb26edf7e77e7c173d478b94100969fc4 (patch)
tree2c26d1f87e2a4c9e3a47a3980a29dfa4667fb613
parentb3d235f63b11effbc88d07ec812f90dbb3f4b798 (diff)
downloadbusybox-0c6a970eb26edf7e77e7c173d478b94100969fc4.zip
busybox-0c6a970eb26edf7e77e7c173d478b94100969fc4.tar.gz
* Fixed a small bug that could cause tar to emit warning messages
and not extract the first file in a directory in some cases of nested directories. Thanks to Kevin Traas <kevin@netmaster.com> for helping track this one down. -Erik
-rw-r--r--Changelog4
-rw-r--r--archival/tar.c7
-rw-r--r--tar.c7
3 files changed, 14 insertions, 4 deletions
diff --git a/Changelog b/Changelog
index 98d145f..30f2820 100644
--- a/Changelog
+++ b/Changelog
@@ -67,6 +67,10 @@
Pavel Roskin
* Syslogd will not go to background if "-n" is given. Better help
and argument checking -- Pavel Roskin
+ * Fixed a small bug that could cause tar to emit warning messages
+ and not extract the first file in a directory in some cases
+ of nested directories. Thanks to Kevin Traas <kevin@netmaster.com>
+ for helping track this one down.
* More doc updates
diff --git a/archival/tar.c b/archival/tar.c
index 7d440f4..86f9965 100644
--- a/archival/tar.c
+++ b/archival/tar.c
@@ -300,11 +300,14 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Open the file to be written, if a file is supposed to be written */
if (extractFlag==TRUE && tostdoutFlag==FALSE) {
- if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, header->mode & ~S_IFMT)) < 0)
- errorMsg(io_error, header->name, strerror(errno));
/* Create the path to the file, just in case it isn't there...
* This should not screw up path permissions or anything. */
createPath(header->name, 0777);
+ if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY,
+ header->mode & ~S_IFMT)) < 0) {
+ errorMsg(io_error, header->name, strerror(errno));
+ return( FALSE);
+ }
}
/* Write out the file, if we are supposed to be doing that */
diff --git a/tar.c b/tar.c
index 7d440f4..86f9965 100644
--- a/tar.c
+++ b/tar.c
@@ -300,11 +300,14 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
/* Open the file to be written, if a file is supposed to be written */
if (extractFlag==TRUE && tostdoutFlag==FALSE) {
- if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, header->mode & ~S_IFMT)) < 0)
- errorMsg(io_error, header->name, strerror(errno));
/* Create the path to the file, just in case it isn't there...
* This should not screw up path permissions or anything. */
createPath(header->name, 0777);
+ if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY,
+ header->mode & ~S_IFMT)) < 0) {
+ errorMsg(io_error, header->name, strerror(errno));
+ return( FALSE);
+ }
}
/* Write out the file, if we are supposed to be doing that */