- name_length = strlen (CURRENT_FILE_NAME);
-
- really_dir:
- /* Remove any redundant trailing "/"s. */
- while (FILESYSTEM_PREFIX_LEN (CURRENT_FILE_NAME) < name_length
- && CURRENT_FILE_NAME[name_length - 1] == '/')
- name_length--;
- CURRENT_FILE_NAME[name_length] = '\0';
-
- if (incremental_option)
- {
- /* Read the entry and delete files that aren't listed in the
- archive. */
-
- gnu_restore (skipcrud);
- }
- else if (typeflag == GNUTYPE_DUMPDIR)
- skip_member ();
-
- if (! prepare_to_extract (CURRENT_FILE_NAME))
- break;
-
- mode = ((current_stat.st_mode
- | (we_are_root ? 0 : MODE_WXUSR))
- & MODE_RWX);
-
- again_dir:
- status = mkdir (CURRENT_FILE_NAME, mode);
-
- if (status != 0)
- {
- if (errno == EEXIST
- && (interdir_made || old_files_option == OVERWRITE_OLD_FILES))
- {
- struct stat st;
- if (stat (CURRENT_FILE_NAME, &st) == 0)
- {
- if (interdir_made)
- {
- repair_delayed_set_stat (CURRENT_FILE_NAME, &st);
- break;
- }
- if (S_ISDIR (st.st_mode))
- {
- mode = st.st_mode & ~ current_umask;
- goto directory_exists;
- }
- }
- errno = EEXIST;
- }
-
- if (maybe_recoverable (CURRENT_FILE_NAME, &interdir_made))
- goto again_dir;
-
- if (errno != EEXIST)
- {
- mkdir_error (CURRENT_FILE_NAME);
- if (backup_option)
- undo_last_backup ();
- break;
- }
- }
-
- directory_exists:
- if (status == 0
- || old_files_option == OVERWRITE_OLD_FILES)
- delay_set_stat (CURRENT_FILE_NAME, ¤t_stat,
- MODE_RWX & (mode ^ current_stat.st_mode),
- (status == 0
- ? ARCHIVED_PERMSTATUS
- : UNKNOWN_PERMSTATUS));