diff options
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -338,7 +338,9 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
338 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { | 338 | if (extractFlag==TRUE && tostdoutFlag==FALSE) { |
339 | /* Create the path to the file, just in case it isn't there... | 339 | /* Create the path to the file, just in case it isn't there... |
340 | * This should not screw up path permissions or anything. */ | 340 | * This should not screw up path permissions or anything. */ |
341 | create_path(header->name, 0777); | 341 | char *dir = dirname (header->name); |
342 | make_directory (dir, -1, FILEUTILS_RECUR); | ||
343 | free (dir); | ||
342 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, | 344 | if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, |
343 | header->mode & ~S_IFMT)) < 0) { | 345 | header->mode & ~S_IFMT)) < 0) { |
344 | error_msg(io_error, header->name, strerror(errno)); | 346 | error_msg(io_error, header->name, strerror(errno)); |
@@ -397,8 +399,7 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag) | |||
397 | if (extractFlag==FALSE || tostdoutFlag==TRUE) | 399 | if (extractFlag==FALSE || tostdoutFlag==TRUE) |
398 | return( TRUE); | 400 | return( TRUE); |
399 | 401 | ||
400 | if (create_path(header->name, header->mode) != TRUE) { | 402 | if (make_directory(header->name, header->mode, FILEUTILS_RECUR) < 0) { |
401 | perror_msg("%s: Cannot mkdir", header->name); | ||
402 | return( FALSE); | 403 | return( FALSE); |
403 | } | 404 | } |
404 | /* make the final component, just in case it was | 405 | /* make the final component, just in case it was |