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

Unified Diff: runtime/bin/process_linux.cc

Issue 15980006: Fix for leaking file descriptor issue (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 7 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/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/process_linux.cc
diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc
index 838dc27a75b7aa23aff65aa67dddc2992a2468c6..e55cb5d029e9bab776550aefa4924ae00f46f622 100644
--- a/runtime/bin/process_linux.cc
+++ b/runtime/bin/process_linux.cc
@@ -534,6 +534,14 @@ int Process::Start(const char* path,
TEMP_FAILURE_RETRY(close(read_err[1]));
TEMP_FAILURE_RETRY(close(write_out[0]));
TEMP_FAILURE_RETRY(close(write_out[1]));
+
+ // Since exec() failed, we're not interested in the exit code.
+ // We close the reading side of the exit code pipe here.
+ // GetProcessExitCodes will get a broken pipe error when it tries to write
+ // to the writing side of the pipe and it will ignore the error.
+ TEMP_FAILURE_RETRY(close(*exit_event));
+ *exit_event = -1;
+
if (bytes_read == -1) {
return errno; // Read failed.
} else {
« no previous file with comments | « runtime/bin/process_android.cc ('k') | runtime/bin/process_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698