removing non-existing file from the build
[folly.git] / folly / File.cpp
index 0dece45d6525ac58ec08544a8d07e57aafa784ec..379efe62eb0c650c5d06b82650635594240f4e1d 100644 (file)
@@ -65,7 +65,11 @@ File& File::operator=(File&& other) {
 }
 
 File::~File() {
-  closeNoThrow();  // ignore error
+  auto fd = fd_;
+  if (!closeNoThrow()) {  // ignore most errors
+    DCHECK_NE(errno, EBADF) << "closing fd " << fd << ", it may already "
+      << "have been closed. Another time, this might close the wrong FD.";
+  }
 }
 
 /* static */ File File::temporary() {