]> Dogcows Code - chaz/tar/commitdiff
(extract_dir): Fix toggling existing directory
authorSergey Poznyakoff <gray@gnu.org.ua>
Tue, 11 Apr 2006 11:59:40 +0000 (11:59 +0000)
committerSergey Poznyakoff <gray@gnu.org.ua>
Tue, 11 Apr 2006 11:59:40 +0000 (11:59 +0000)
permissions. Use parts of patch provided by Ian Jackson
<iwj@ubuntu.com>.

src/extract.c

index a630bb799dea386b9f4e598a37c6b6f35baad50e..408208392ab64a69afd7a116c4c12960117ba5f2 100644 (file)
@@ -428,7 +428,7 @@ make_directories (char *file_name)
             invert_permissions is zero, because
             repair_delayed_set_stat may need to update the struct.  */
          delay_set_stat (file_name,
-                         &current_stat_info /* ignored */,
+                         &current_stat_info,
                          invert_permissions, INTERDIR_PERMSTATUS);
 
          print_for_mkdir (file_name, cursor - file_name, mode);
@@ -647,7 +647,7 @@ extract_dir (char *file_name, int typeflag)
                }
              if (S_ISDIR (st.st_mode))
                {
-                 mode = st.st_mode & ~ current_umask;
+                 mode = st.st_mode;
                  break;
                }
            }
@@ -668,12 +668,16 @@ extract_dir (char *file_name, int typeflag)
   if (status == 0
       || old_files_option == DEFAULT_OLD_FILES
       || old_files_option == OVERWRITE_OLD_FILES)
-    delay_set_stat (file_name, &current_stat_info,
-                   MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
-                   (status == 0
-                    ? ARCHIVED_PERMSTATUS
-                    : UNKNOWN_PERMSTATUS));
-
+    {
+      if (status == 0)
+       delay_set_stat (file_name, &current_stat_info,
+                       MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
+                       ARCHIVED_PERMSTATUS);
+      else /* For an already existing directory, invert_perms must be 0 */
+       delay_set_stat (file_name, &current_stat_info,
+                       0,
+                       UNKNOWN_PERMSTATUS);
+    }
   return status;
 }
 
This page took 0.030983 seconds and 4 git commands to generate.