summaryrefslogtreecommitdiff
path: root/archival/tar.c
diff options
context:
space:
mode:
authorMatt Kraai <kraai@debian.org>2001-08-24 19:51:54 +0000
committerMatt Kraai <kraai@debian.org>2001-08-24 19:51:54 +0000
commitac20ce1924a0eb563acfda6533a80701cd611bfa (patch)
tree5209668fde99a5caa4ed41d8d61c73770fcae646 /archival/tar.c
parent2a953aed3831f8705444e720783ad4781904a625 (diff)
downloadbusybox-w32-ac20ce1924a0eb563acfda6533a80701cd611bfa.tar.gz
busybox-w32-ac20ce1924a0eb563acfda6533a80701cd611bfa.tar.bz2
busybox-w32-ac20ce1924a0eb563acfda6533a80701cd611bfa.zip
Canonicalize dirname(3) behavior.
Diffstat (limited to 'archival/tar.c')
-rw-r--r--archival/tar.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/archival/tar.c b/archival/tar.c
index cf65798ff..389d7f02e 100644
--- a/archival/tar.c
+++ b/archival/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));