Fix ownership of extracted directories.
authorMatt Kraai <kraai@debian.org>
Sat, 13 Jan 2001 21:46:25 +0000 (21:46 -0000)
committerMatt Kraai <kraai@debian.org>
Sat, 13 Jan 2001 21:46:25 +0000 (21:46 -0000)
archival/tar.c
tar.c

index 9a3cff361841e56972f13b7aac5d431222df636a..844559580faf031c872663f64b27ebdf4f6c850b 100644 (file)
@@ -426,9 +426,12 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
        /* make the final component, just in case it was
         * omitted by create_path() (which will skip the
         * directory if it doesn't have a terminating '/') */
-       if (mkdir(header->name, header->mode) == 0) {
-               fixUpPermissions(header);
+       if (mkdir(header->name, header->mode) < 0 && errno != EEXIST) {
+               perror_msg("%s", header->name);
+               return FALSE;
        }
+
+       fixUpPermissions(header);
        return( TRUE);
 }
 
diff --git a/tar.c b/tar.c
index 9a3cff361841e56972f13b7aac5d431222df636a..844559580faf031c872663f64b27ebdf4f6c850b 100644 (file)
--- a/tar.c
+++ b/tar.c
@@ -426,9 +426,12 @@ tarExtractDirectory(TarInfo *header, int extractFlag, int tostdoutFlag)
        /* make the final component, just in case it was
         * omitted by create_path() (which will skip the
         * directory if it doesn't have a terminating '/') */
-       if (mkdir(header->name, header->mode) == 0) {
-               fixUpPermissions(header);
+       if (mkdir(header->name, header->mode) < 0 && errno != EEXIST) {
+               perror_msg("%s", header->name);
+               return FALSE;
        }
+
+       fixUpPermissions(header);
        return( TRUE);
 }