mirror of
https://github.com/NixOS/nix
synced 2025-06-25 10:41:16 +02:00
Merge pull request #12103 from CertainLach/fsync-store-paths-symlinks
fix: ignore symlinks in fsync-store-paths
This commit is contained in:
commit
bff9296ab9
1 changed files with 3 additions and 2 deletions
|
@ -331,7 +331,7 @@ void syncParent(const Path & path)
|
||||||
|
|
||||||
void recursiveSync(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);
|
auto st = lstat(path);
|
||||||
if (S_ISREG(st.st_mode)) {
|
if (S_ISREG(st.st_mode)) {
|
||||||
AutoCloseFD fd = toDescriptor(open(path.c_str(), O_RDONLY, 0));
|
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);
|
throw SysError("opening file '%1%'", path);
|
||||||
fd.fsync();
|
fd.fsync();
|
||||||
return;
|
return;
|
||||||
}
|
} else if (S_ISLNK(st.st_mode))
|
||||||
|
return;
|
||||||
|
|
||||||
/* Otherwise, perform a depth-first traversal of the directory and
|
/* Otherwise, perform a depth-first traversal of the directory and
|
||||||
fsync all the files. */
|
fsync all the files. */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue