- if (function & extract_preserve_date) {
- t.actime = file_entry->mtime;
- t.modtime = file_entry->mtime;
- utime(full_name, &t);
+
+ /* Changing a symlink's properties normally changes the properties of the
+ * file pointed to, so dont try and change the date or mode, lchown does
+ * does the right thing, but isnt available in older versions of libc */
+ if (S_ISLNK(file_entry->mode)) {
+#if (__GLIBC__ >= 2) && (__GLIBC_MINOR__ >= 1)
+ lchown(full_name, file_entry->uid, file_entry->gid);
+#endif
+ } else {
+ if (function & extract_preserve_date) {
+ t.actime = file_entry->mtime;
+ t.modtime = file_entry->mtime;
+ utime(full_name, &t);
+ }
+ chmod(full_name, file_entry->mode);
+ chown(full_name, file_entry->uid, file_entry->gid);