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

Unified Diff: base/process_util_linux.cc

Issue 18801: Add routine to close file descriptors on exec (Closed)
Patch Set: final cleanups Created 11 years, 11 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 | « base/process_util.h ('k') | base/process_util_mac.mm » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_linux.cc
diff --git a/base/process_util_linux.cc b/base/process_util_linux.cc
index d53b2c73ef8812d722182cd674873494fcd0a85f..8f83212d93642009ca1e2b39cd6e4b5fd202d6df 100644
--- a/base/process_util_linux.cc
+++ b/base/process_util_linux.cc
@@ -44,13 +44,7 @@ bool LaunchApp(const std::vector<std::string>& argv,
// Make sure we don't leak any FDs to the child process by marking all FDs
// as close-on-exec.
- int max_files = GetMaxFilesOpenInProcess();
- for (int i = STDERR_FILENO + 1; i < max_files; i++) {
- int flags = fcntl(i, F_GETFD);
- if (flags != -1) {
- fcntl(i, F_SETFD, flags | FD_CLOEXEC);
- }
- }
+ SetAllFDsToCloseOnExec();
int pid = fork();
if (pid == 0) {
« no previous file with comments | « base/process_util.h ('k') | base/process_util_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698