init: add missing O_CLOEXEC

Test: (hopefully) no more denials at boot
Change-Id: I7c20a9bbf27210e0ee5f1bbe69db36bb47c38892
This commit is contained in:
Tom Cherry 2019-12-09 06:48:37 -08:00
parent ca7fbd546c
commit c99d60cbc7
1 changed files with 1 additions and 1 deletions

View File

@ -198,7 +198,7 @@ Result<void> WritePersistentPropertyFile(const PersistentProperties& persistent_
// Note in this case, that the source and destination directories are the same, so only one
// fsync() is required.
auto dir = Dirname(persistent_property_filename);
auto dir_fd = unique_fd{open(dir.c_str(), O_DIRECTORY | O_RDONLY)};
auto dir_fd = unique_fd{open(dir.c_str(), O_DIRECTORY | O_RDONLY | O_CLOEXEC)};
if (dir_fd < 0) {
return ErrnoError() << "Unable to open persistent properties directory for fsync()";
}