Skip to content

Commit

Permalink
Merge of #12179
Browse files Browse the repository at this point in the history
  • Loading branch information
mergify[bot] authored Jan 10, 2025
2 parents 846a489 + 24a9c6f commit d3cae52
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 d3cae52

Please sign in to comment.