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

Unified Diff: runtime/bin/fdutils_linux.cc

Issue 11416006: Added FD_CLOEXEC flag to client/server socket file descriptors (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 1 month 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/fdutils_android.cc ('k') | runtime/bin/fdutils_macos.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/fdutils_linux.cc
diff --git a/runtime/bin/fdutils_linux.cc b/runtime/bin/fdutils_linux.cc
index 7e8f72b9097d64adfd0b05a0be57d6831c027196..8d946e68677b1d5a86e41fbb3ad89a8c7cb20f41 100644
--- a/runtime/bin/fdutils_linux.cc
+++ b/runtime/bin/fdutils_linux.cc
@@ -10,6 +10,22 @@
#include "bin/fdutils.h"
+bool FDUtils::SetCloseOnExec(intptr_t fd) {
+ intptr_t status;
+ status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFD));
+ if (status < 0) {
+ perror("fcntl F_GETFD failed");
+ return false;
+ }
+ status |= FD_CLOEXEC;
+ if (TEMP_FAILURE_RETRY(fcntl(fd, F_SETFD, status)) < 0) {
+ perror("fcntl F_SETFD failed");
+ return false;
+ }
+ return true;
+}
+
+
static bool SetBlockingHelper(intptr_t fd, bool blocking) {
intptr_t status;
status = TEMP_FAILURE_RETRY(fcntl(fd, F_GETFL));
« no previous file with comments | « runtime/bin/fdutils_android.cc ('k') | runtime/bin/fdutils_macos.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698