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

Unified Diff: base/process/launch_posix.cc

Issue 126823003: posix LaunchProcess: remove more iterator usage that was missed in r243401 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/launch.h ('k') | components/nacl/zygote/nacl_fork_delegate_linux.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/process/launch_posix.cc
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc
index 55a16dc0f6c3dcf39b47419ec768fbfb8c89ea7f..daa055dfee9ef667f4d09d87bde76e4d98fb4f51 100644
--- a/base/process/launch_posix.cc
+++ b/base/process/launch_posix.cc
@@ -320,6 +320,9 @@ bool LaunchProcess(const std::vector<std::string>& argv,
} else if (pid == 0) {
// Child process
+ // DANGER: no calls to malloc or locks are allowed from now on:
+ // http://crbug.com/36678
+
// DANGER: 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
@@ -358,16 +361,14 @@ bool LaunchProcess(const std::vector<std::string>& argv,
if (options.maximize_rlimits) {
// Some resource limits need to be maximal in this child.
- std::set<int>::const_iterator resource;
- for (resource = options.maximize_rlimits->begin();
- resource != options.maximize_rlimits->end();
- ++resource) {
+ for (size_t i = 0; i < options.maximize_rlimits->size(); ++i) {
+ const int resource = (*options.maximize_rlimits)[i];
struct rlimit limit;
- if (getrlimit(*resource, &limit) < 0) {
+ if (getrlimit(resource, &limit) < 0) {
RAW_LOG(WARNING, "getrlimit failed");
} else if (limit.rlim_cur < limit.rlim_max) {
limit.rlim_cur = limit.rlim_max;
- if (setrlimit(*resource, &limit) < 0) {
+ if (setrlimit(resource, &limit) < 0) {
RAW_LOG(WARNING, "setrlimit failed");
}
}
@@ -390,9 +391,6 @@ bool LaunchProcess(const std::vector<std::string>& argv,
memset(reinterpret_cast<void*>(malloc), 0xff, 8);
#endif // 0
- // DANGER: no calls to malloc or locks are allowed from now on:
- // http://crbug.com/36678
-
#if defined(OS_CHROMEOS)
if (options.ctrl_terminal_fd >= 0) {
// Set process' controlling terminal.
@@ -521,11 +519,12 @@ static GetAppOutputInternalResult GetAppOutputInternal(
return EXECUTE_FAILURE;
case 0: // child
{
+ // DANGER: no calls to malloc or locks are allowed from now on:
+ // http://crbug.com/36678
+
#if defined(OS_MACOSX)
RestoreDefaultExceptionHandler();
#endif
- // DANGER: no calls to malloc or locks are allowed from now on:
- // http://crbug.com/36678
// 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
@@ -547,8 +546,8 @@ static GetAppOutputInternalResult GetAppOutputInternal(
// Adding another element here? Remeber to increase the argument to
// reserve(), above.
- std::copy(fd_shuffle1.begin(), fd_shuffle1.end(),
- std::back_inserter(fd_shuffle2));
+ for (size_t i = 0; i < fd_shuffle1.size(); ++i)
+ fd_shuffle2.push_back(fd_shuffle1[i]);
if (!ShuffleFileDescriptors(&fd_shuffle1))
_exit(127);
« no previous file with comments | « base/process/launch.h ('k') | components/nacl/zygote/nacl_fork_delegate_linux.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698