tar: don't change modes for hardlinks on extraction

Changing timestamps, modes and ownership of hardlinks
makes no sense.
This commit is contained in:
Eivind Uggedal 2016-02-15 08:03:17 +00:00 committed by sin
parent 2f128ab050
commit 3c2f8b0cfa

3
tar.c
View File

@ -325,6 +325,9 @@ unarchive(char *fname, ssize_t l, char b[BLKSIZ])
close(fd); close(fd);
} }
if (h->type == HARDLINK)
return 0;
times[0].tv_sec = times[1].tv_sec = mtime; times[0].tv_sec = times[1].tv_sec = mtime;
times[0].tv_nsec = times[1].tv_nsec = 0; times[0].tv_nsec = times[1].tv_nsec = 0;
if (!mflag && utimensat(AT_FDCWD, fname, times, AT_SYMLINK_NOFOLLOW) < 0) if (!mflag && utimensat(AT_FDCWD, fname, times, AT_SYMLINK_NOFOLLOW) < 0)