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

Unified Diff: base/process_util_linux.cc

Issue 159275: Linux: Use _exit() instead of exit() in the child after fork() in failure conditions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 11 years, 5 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 | « no previous file | base/process_util_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process_util_linux.cc
===================================================================
--- base/process_util_linux.cc (revision 21395)
+++ base/process_util_linux.cc (working copy)
@@ -113,8 +113,13 @@
}
}
+ // Obscure fork() rule: in the child, if you don't end up doing exec*(),
+ // you call _exit() instead of exit(). This is because _exit() does not
+ // call any previously-registered (in the parent) exit handlers, which
+ // might do things like block waiting for threads that don't even exist
+ // in the child.
if (!ShuffleFileDescriptors(fd_shuffle))
- exit(127);
+ _exit(127);
// If we are using the SUID sandbox, it sets a magic environment variable
// ("SBX_D"), so we remove that variable from the environment here on the
@@ -130,7 +135,7 @@
execvp(argv_cstr[0], argv_cstr.get());
LOG(ERROR) << "LaunchApp: exec failed!, argv_cstr[0] " << argv_cstr[0]
<< ", errno " << errno;
- exit(127);
+ _exit(127);
} else {
// Parent process
if (wait)
« no previous file with comments | « no previous file | base/process_util_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698