Skip to content

Commit

Permalink
Restore modification time on symbolic links (#43)
Browse files Browse the repository at this point in the history
Co-authored-by: Kostas Liakakis <koukou73gr@gmail.com>
  • Loading branch information
koukou73gr and Kostas Liakakis authored Apr 7, 2021
1 parent 213a84f commit e6db196
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions fs-up.c
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,18 @@ mk_link(struct rdup *e, char *p, GHashTable * uidhash, GHashTable * gidhash)
}
}
mk_chown(e, uidhash, gidhash);

// Set mtime and atime through lutimes(2);
struct timeval times[2];

// Element 0 is atime, 1 is mtime
times[0].tv_sec = times[1].tv_sec = e->f_mtime;
times[0].tv_usec = times[1].tv_usec = 0;
if ( lutimes(e->f_name, times) == -1)
{
msgd(__func__, __LINE__, _("Failed to set mtime on symlink target '%s\': %s"),
e->f_name, strerror(errno));
}
return TRUE;
}

Expand Down

0 comments on commit e6db196

Please sign in to comment.