aboutsummaryrefslogtreecommitdiff
path: root/tar.c
diff options
context:
space:
mode:
Diffstat (limited to 'tar.c')
-rw-r--r--tar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/tar.c b/tar.c
index cf65798ff..389d7f02e 100644
--- a/tar.c
+++ b/tar.c
@@ -342,9 +342,11 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag)
342 if (extractFlag==TRUE && tostdoutFlag==FALSE) { 342 if (extractFlag==TRUE && tostdoutFlag==FALSE) {
343 /* Create the path to the file, just in case it isn't there... 343 /* Create the path to the file, just in case it isn't there...
344 * This should not screw up path permissions or anything. */ 344 * This should not screw up path permissions or anything. */
345 char *dir = dirname (header->name); 345 char *buf, *dir;
346 buf = xstrdup (header->name);
347 dir = dirname (buf);
346 make_directory (dir, -1, FILEUTILS_RECUR); 348 make_directory (dir, -1, FILEUTILS_RECUR);
347 free (dir); 349 free (buf);
348 if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, 350 if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY,
349 header->mode & ~S_IFMT)) < 0) { 351 header->mode & ~S_IFMT)) < 0) {
350 error_msg(io_error, header->name, strerror(errno)); 352 error_msg(io_error, header->name, strerror(errno));