Skip to content

Commit

Permalink
Merge pull request #12179 from NixOS/mergify/bp/2.25-maintenance/pr-1…
Browse files Browse the repository at this point in the history
…2103

fix: ignore symlinks in fsync-store-paths (backport #12103)
  • Loading branch information
mergify[bot] authored Jan 10, 2025
2 parents 7a7a3d2 + 24a9c6f commit 009de1f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/libutil/file-system.cc
Original file line number Diff line number Diff line change
Expand Up @@ -331,15 +331,16 @@ void syncParent(const Path & path)

void recursiveSync(const Path & path)
{
/* If it's a file, just fsync and return. */
/* If it's a file or symlink, just fsync and return. */
auto st = lstat(path);
if (S_ISREG(st.st_mode)) {
AutoCloseFD fd = toDescriptor(open(path.c_str(), O_RDONLY, 0));
if (!fd)
throw SysError("opening file '%1%'", path);
fd.fsync();
return;
}
} else if (S_ISLNK(st.st_mode))
return;

/* Otherwise, perform a depth-first traversal of the directory and
fsync all the files. */
Expand Down

0 comments on commit 009de1f

Please sign in to comment.