summaryrefslogtreecommitdiffhomepage
path: root/archival/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/archival/tar.c b/archival/tar.c
index 7d440f451..86f996576 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 */