[libcxx-commits] [PATCH] D90601: [libcxx] Avoid double frees of file descriptors in the fallback ifstream/ofstream codepath

Martin Storsjö via Phabricator via libcxx-commits libcxx-commits at lists.llvm.org
Mon Nov 2 23:33:45 PST 2020


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG08b4cc5e0d26: [libcxx] Avoid double frees of file descriptors in the fallback… (authored by mstorsjo).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D90601/new/

https://reviews.llvm.org/D90601

Files:
  libcxx/src/filesystem/operations.cpp


Index: libcxx/src/filesystem/operations.cpp
===================================================================
--- libcxx/src/filesystem/operations.cpp
+++ libcxx/src/filesystem/operations.cpp
@@ -684,12 +684,14 @@
       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>;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D90601.302476.patch
Type: text/x-patch
Size: 549 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20201103/fa0c3a7f/attachment-0001.bin>


More information about the libcxx-commits mailing list