diff --git a/src/os/LFNIndex.cc b/src/os/LFNIndex.cc index c021668f159..1e11a309030 100644 --- a/src/os/LFNIndex.cc +++ b/src/os/LFNIndex.cc @@ -171,9 +171,9 @@ int LFNIndex::fsync_dir(const vector &path) int fd = ::open(get_full_path_subdir(path).c_str(), O_RDONLY); if (fd < 0) return -errno; + FDCloser f(fd); maybe_inject_failure(); int r = ::fsync(fd); - VOID_TEMP_FAILURE_RETRY(::close(fd)); maybe_inject_failure(); if (r < 0) return -errno;