From ac20ce1924a0eb563acfda6533a80701cd611bfa Mon Sep 17 00:00:00 2001 From: Matt Kraai Date: Fri, 24 Aug 2001 19:51:54 +0000 Subject: Canonicalize dirname(3) behavior. --- archival/tar.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'archival/tar.c') 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) 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)); -- cgit v1.2.3