[all-commits] [llvm/llvm-project] 3906eb: [libc++] Fix double file closing in `std::filesyst...
Louis Dionne via All-commits
all-commits at lists.llvm.org
Mon Feb 28 09:57:10 PST 2022
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 3906ebf750b80e36c2d6c52130cf40771e1b55fb
https://github.com/llvm/llvm-project/commit/3906ebf750b80e36c2d6c52130cf40771e1b55fb
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
More information about the All-commits
mailing list