1
1
Fork 0
mirror of https://github.com/NixOS/nix.git synced 2025-11-16 23:42:43 +01:00

Merge pull request #12179 from NixOS/mergify/bp/2.25-maintenance/pr-12103

fix: ignore symlinks in fsync-store-paths (backport #12103)
This commit is contained in:
mergify[bot] 2025-01-10 18:55:11 +00:00 committed by GitHub
commit 009de1f7ac
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -331,7 +331,7 @@ 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));
@ -339,7 +339,8 @@ void recursiveSync(const Path & path)
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. */