[all-commits] [llvm/llvm-project] d61805: [libc++] Fix double file closing in `std::filesyst...
Louis Dionne via All-commits
all-commits at lists.llvm.org
Mon Feb 28 09:57:44 PST 2022
Branch: refs/heads/release/14.x
Home: https://github.com/llvm/llvm-project
Commit: d61805a8b6863663754b1d35ad5d3b25c30365cf
https://github.com/llvm/llvm-project/commit/d61805a8b6863663754b1d35ad5d3b25c30365cf
Author: Konstantin Varlamov <varconst at apple.com>
Date: 2022-02-28 (Mon, 28 Feb 2022)
Changed paths:
M libcxx/src/filesystem/operations.cpp
Log Message:
-----------
[libc++] Fix double file closing in `std::filesystem::remove_all()`.
According to Linux documentation (see e.g. https://linux.die.net/man/3/closedir):
> A successful call to `closedir()` also closes the underlying file
> descriptor associated with `dirp`.
Thus, calling `close()` after a successful call to `closedir()` is at
best redundant. Worse, should a different thread open a file in-between
the calls to `closedir()` and `close()` and get the same file descriptor,
the call to `close()` might actually close a different file than was
intended.
rdar://89251874
Differential Revision: https://reviews.llvm.org/D120453
(cherry picked from commit 3906ebf750b80e36c2d6c52130cf40771e1b55fb)
More information about the All-commits
mailing list