--- tar-1.23/src/extract.c-orig 2010-01-26 12:28:09.000000000 +0100 +++ tar-1.23/src/extract.c 2010-04-21 12:40:51.000000000 +0200 @@ -253,34 +253,32 @@ 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. */ + + /* 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 (! touch_option && permstatus != INTERDIR_PERMSTATUS) + if (lutimens (file_name, ts) != 0) + utime_error (file_name); + else { - /* 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]); - } + 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. @@ -288,7 +286,6 @@ 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) {