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

Unified Diff: runtime/bin/fdutils_macos.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_linux.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/fdutils_macos.cc
diff --git a/runtime/bin/fdutils_macos.cc b/runtime/bin/fdutils_macos.cc
index b9ea0493bd19793873ed51ff86bb8ce1529d37e0..92e63fcefd56882579cddc02c9e99d5d759cd0f3 100644
--- a/runtime/bin/fdutils_macos.cc
+++ b/runtime/bin/fdutils_macos.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_linux.cc ('k') | runtime/bin/socket_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698