X-Git-Url: https://git.cworth.org/git?a=blobdiff_plain;f=src%2Fextract.c;h=5ca192de3a90000c73bf0db898418a5955fcb1c4;hb=e03c60da0f4907cead18d8957cd78dbeec18ab23;hp=0d938e63798a1142a1b7253bd415aa8f94d14b52;hpb=138fc7e67e3d9845cd7d81aad0e9c7724784f9b9;p=tar diff --git a/src/extract.c b/src/extract.c index 0d938e6..5ca192d 100644 --- a/src/extract.c +++ b/src/extract.c @@ -239,43 +239,40 @@ set_stat (char const *file_name, mode_t invert_permissions, enum permstatus permstatus, char typeflag) { - if (typeflag != SYMTYPE) + /* We do the utime before the chmod because some versions of utime are + broken and trash the modes of the file. */ + + if (! touch_option && permstatus != INTERDIR_PERMSTATUS) { - /* We do the utime before the chmod because some versions of utime are - broken and trash the modes of the file. */ + /* We set the accessed time to `now', which is really the time we + started extracting files, unless incremental_option is used, in + which case .st_atime is used. */ - if (! touch_option && permstatus != INTERDIR_PERMSTATUS) - { - /* We set the accessed time to `now', which is really the time we - started extracting files, unless incremental_option is used, in - which case .st_atime is used. */ - - /* FIXME: incremental_option should set ctime too, but how? */ - - struct timespec ts[2]; - if (incremental_option) - ts[0] = st->atime; - else - ts[0] = start_time; - ts[1] = st->mtime; - - if (utimens (file_name, ts) != 0) - utime_error (file_name); - else - { - check_time (file_name, ts[0]); - check_time (file_name, ts[1]); - } - } + /* FIXME: incremental_option should set ctime too, but how? */ - /* Some systems allow non-root users to give files away. Once this - done, it is not possible anymore to change file permissions. - However, setting file permissions now would be incorrect, since - they would apply to the wrong user, and there would be a race - condition. So, don't use systems that allow non-root users to - give files away. */ + struct timespec ts[2]; + if (incremental_option) + ts[0] = st->atime; + else + ts[0] = start_time; + ts[1] = st->mtime; + + if (utimens (file_name, ts, typeflag == SYMTYPE) != 0) + utime_error (file_name); + else + { + check_time (file_name, ts[0]); + check_time (file_name, ts[1]); + } } + /* Some systems allow non-root users to give files away. Once this + done, it is not possible anymore to change file permissions. + However, setting file permissions now would be incorrect, since + they would apply to the wrong user, and there would be a race + condition. So, don't use systems that allow non-root users to + give files away. */ + if (0 < same_owner_option && permstatus != INTERDIR_PERMSTATUS) { /* When lchown exists, it should be used to change the attributes of @@ -917,7 +914,6 @@ extract_link (char *file_name, int typeflag) int interdir_made = 0; char const *link_name; - transform_member_name (¤t_stat_info.link_name, xform_link); link_name = current_stat_info.link_name; if (! absolute_names_option && contains_dot_dot (link_name)) @@ -974,8 +970,6 @@ extract_symlink (char *file_name, int typeflag) int status; int interdir_made = 0; - transform_member_name (¤t_stat_info.link_name, xform_symlink); - if (! absolute_names_option && (IS_ABSOLUTE_FILE_NAME (current_stat_info.link_name) || contains_dot_dot (current_stat_info.link_name)))