Skip to content

Commit

Permalink
fcopy: handle case where src is a symlink to a directory
Browse files Browse the repository at this point in the history
  • Loading branch information
reedriley committed Feb 2, 2022
1 parent 7635f72 commit c0822a0
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/fcopy/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -403,8 +403,11 @@ static void duplicate_link(const char *src, const char *dest, struct stat *s) {
mode_t mode = s->st_mode;

// NixOS problem #4887:
// /etc/fonts is a double symlink to a directory - copy the files instead of copying the symlink
if (strcmp(src, "/etc/fonts") == 0) {
// /etc/fonts is a directory symlink - and we don't want to copy
// symlinks to directories as if they were files. Instead;
// duplicate the source directory instead
struct stat s_follow;
if (stat(rsrc, &s_follow) == EXIT_SUCCESS && S_ISDIR(s_follow.st_mode)) {
duplicate_dir(src, dest, s);
free(rsrc);
free(rdest);
Expand Down

0 comments on commit c0822a0

Please sign in to comment.