diff options
author | Matt Kraai | 2001-08-24 19:51:54 +0000 |
---|---|---|
committer | Matt Kraai | 2001-08-24 19:51:54 +0000 |
commit | ac20ce1924a0eb563acfda6533a80701cd611bfa (patch) | |
tree | 5209668fde99a5caa4ed41d8d61c73770fcae646 /tar.c | |
parent | 2a953aed3831f8705444e720783ad4781904a625 (diff) | |
download | busybox-ac20ce1924a0eb563acfda6533a80701cd611bfa.zip busybox-ac20ce1924a0eb563acfda6533a80701cd611bfa.tar.gz |
Canonicalize dirname(3) behavior.
Diffstat (limited to 'tar.c')
-rw-r--r-- | tar.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -342,9 +342,11 @@ tarExtractRegularFile(TarInfo *header, int extractFlag, int tostdoutFlag) if (extractFlag==TRUE && tostdoutFlag==FALSE) { /* Create the path to the file, just in case it isn't there... * This should not screw up path permissions or anything. */ - char *dir = dirname (header->name); + char *buf, *dir; + buf = xstrdup (header->name); + dir = dirname (buf); make_directory (dir, -1, FILEUTILS_RECUR); - free (dir); + free (buf); if ((outFd=open(header->name, O_CREAT|O_TRUNC|O_WRONLY, header->mode & ~S_IFMT)) < 0) { error_msg(io_error, header->name, strerror(errno)); |