projects
/
platform
/
upstream
/
llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
1198724
)
[libcxx] Avoid double frees of file descriptors in the fallback ifstream/ofstream...
author
Martin Storsjö
<martin@martin.st>
Mon, 2 Nov 2020 08:19:42 +0000
(10:19 +0200)
committer
Martin Storsjö
<martin@martin.st>
Tue, 3 Nov 2020 07:32:52 +0000
(09:32 +0200)
So far, most actual uses of libc++ std::filesystem probably use
the sendfile or fcopyfile implementations.
Differential Revision: https://reviews.llvm.org/D90601
libcxx/src/filesystem/operations.cpp
patch
|
blob
|
history
diff --git
a/libcxx/src/filesystem/operations.cpp
b/libcxx/src/filesystem/operations.cpp
index
788e31b
..
6a25979
100644
(file)
--- a/
libcxx/src/filesystem/operations.cpp
+++ b/
libcxx/src/filesystem/operations.cpp
@@
-684,12
+684,14
@@
namespace {
ec = capture_errno();
return false;
}
+ read_fd.fd = -1;
ofstream out;
out.__open(write_fd.fd, ios::binary);
if (!out.is_open()) {
ec = capture_errno();
return false;
}
+ write_fd.fd = -1;
if (in.good() && out.good()) {
using InIt = istreambuf_iterator<char>;