Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(495)

Unified Diff: runtime/bin/file_linux.cc

Issue 233053004: Fix File:copy FD leak, and add file-closes to some tests. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file_android.cc ('k') | tests/standalone/io/file_input_stream_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/file_linux.cc
diff --git a/runtime/bin/file_linux.cc b/runtime/bin/file_linux.cc
index 92c5637c6158ae1958b97bf8d22de00fad38511a..4753a8b6cc8c3a634ab6e1985c5a9674233119ce 100644
--- a/runtime/bin/file_linux.cc
+++ b/runtime/bin/file_linux.cc
@@ -265,10 +265,10 @@ bool File::Copy(const char* old_path, const char* new_path) {
}
}
}
+ int e = errno;
+ VOID_TEMP_FAILURE_RETRY(close(old_fd));
+ VOID_TEMP_FAILURE_RETRY(close(new_fd));
if (result < 0) {
- int e = errno;
- VOID_TEMP_FAILURE_RETRY(close(old_fd));
- VOID_TEMP_FAILURE_RETRY(close(new_fd));
VOID_NO_RETRY_EXPECTED(unlink(new_path));
errno = e;
return false;
« no previous file with comments | « runtime/bin/file_android.cc ('k') | tests/standalone/io/file_input_stream_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698