+ if (! skip_this_one)
+ set_stat (data->file_name, &data->stat_info, cur_info,
+ data->invert_permissions, data->permstatus, DIRTYPE);
+
+ delayed_set_stat_head = data->next;
+ free (data);
+ }
+}
+
+
+void
+extract_dir (char *file_name, int typeflag)
+{
+ int status;
+ mode_t mode;
+ int interdir_made = 0;
+
+ if (incremental_option)
+ /* Read the entry and delete files that aren't listed in the archive. */
+ purge_directory (file_name);
+ else if (typeflag == GNUTYPE_DUMPDIR)
+ skip_member ();
+
+ mode = (current_stat_info.stat.st_mode | (we_are_root ? 0 : MODE_WXUSR)) & MODE_RWX;
+
+ status = prepare_to_extract (file_name);
+ if (status == 0)
+ return;
+
+ if (status > 0)
+ while ((status = mkdir (file_name, mode)))
+ {
+ if (errno == EEXIST
+ && (interdir_made
+ || old_files_option == DEFAULT_OLD_FILES
+ || old_files_option == OVERWRITE_OLD_FILES))
+ {
+ struct stat st;
+ if (stat (file_name, &st) == 0)
+ {
+ if (interdir_made)
+ {
+ repair_delayed_set_stat (file_name, &st);
+ return;
+ }
+ if (S_ISDIR (st.st_mode))
+ {
+ mode = st.st_mode & ~ current_umask;
+ break;
+ }
+ }
+ errno = EEXIST;
+ }
+
+ if (maybe_recoverable (file_name, &interdir_made))
+ continue;
+
+ if (errno != EEXIST)
+ {
+ mkdir_error (file_name);
+ if (backup_option)
+ undo_last_backup ();
+ return;
+ }
+ break;
+ }
+
+ if (status == 0
+ || old_files_option == DEFAULT_OLD_FILES
+ || old_files_option == OVERWRITE_OLD_FILES)
+ delay_set_stat (file_name, ¤t_stat_info.stat,
+ MODE_RWX & (mode ^ current_stat_info.stat.st_mode),
+ (status == 0
+ ? ARCHIVED_PERMSTATUS
+ : UNKNOWN_PERMSTATUS));
+}
+
+
+static int
+open_output_file (char *file_name, int typeflag)
+{
+ int fd;
+ int openflag = (O_WRONLY | O_BINARY | O_CREAT
+ | (old_files_option == OVERWRITE_OLD_FILES
+ ? O_TRUNC
+ : O_EXCL));
+ mode_t mode = current_stat_info.stat.st_mode & MODE_RWX & ~ current_umask;
+
+#if O_CTG
+ /* Contiguous files (on the Masscomp) have to specify the size in
+ the open call that creates them. */
+
+ if (typeflag == CONTTYPE)
+ fd = open (file_name, openflag | O_CTG, mode, current_stat_info.stat.st_size);
+ else
+ fd = open (file_name, openflag, mode);
+
+#else /* not O_CTG */
+ if (typeflag == CONTTYPE)
+ {
+ static int conttype_diagnosed;
+
+ if (!conttype_diagnosed)