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

Side by Side Diff: base/process_util_linux.cc

Issue 112074: Linux: Add support for chrooted renderers. (Closed)
Patch Set: Created 11 years, 6 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/app/chrome_dll_main.cc » ('j') | chrome/app/chrome_dll_main.cc » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/process_util.h" 5 #include "base/process_util.h"
6 6
7 #include <ctype.h> 7 #include <ctype.h>
8 #include <dirent.h> 8 #include <dirent.h>
9 #include <fcntl.h> 9 #include <fcntl.h>
10 #include <unistd.h> 10 #include <unistd.h>
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 for (file_handle_mapping_vector::const_iterator 53 for (file_handle_mapping_vector::const_iterator
54 it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) { 54 it = fds_to_remap.begin(); it != fds_to_remap.end(); ++it) {
55 fd_shuffle.push_back(InjectionArc(it->first, it->second, false)); 55 fd_shuffle.push_back(InjectionArc(it->first, it->second, false));
56 } 56 }
57 57
58 if (!ShuffleFileDescriptors(fd_shuffle)) 58 if (!ShuffleFileDescriptors(fd_shuffle))
59 exit(127); 59 exit(127);
60 60
61 CloseSuperfluousFds(fd_shuffle); 61 CloseSuperfluousFds(fd_shuffle);
62 62
63 // If we are using the SUID sandbox, it sets a magic environment variable
64 // ("SBX_D"), so we remove that variable from the environment here on the
65 // off chance that it's already set.
66 unsetenv("SBX_D");
67
63 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]); 68 scoped_array<char*> argv_cstr(new char*[argv.size() + 1]);
64 for (size_t i = 0; i < argv.size(); i++) 69 for (size_t i = 0; i < argv.size(); i++)
65 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); 70 argv_cstr[i] = const_cast<char*>(argv[i].c_str());
66 argv_cstr[argv.size()] = NULL; 71 argv_cstr[argv.size()] = NULL;
67 execvp(argv_cstr[0], argv_cstr.get()); 72 execvp(argv_cstr[0], argv_cstr.get());
68 exit(127); 73 exit(127);
69 } else { 74 } else {
70 if (wait) 75 if (wait)
71 HANDLE_EINTR(waitpid(pid, 0, 0)); 76 HANDLE_EINTR(waitpid(pid, 0, 0));
72 77
(...skipping 202 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token()); 280 (*io_counters).WriteTransferCount = StringToInt64(tokenizer.token());
276 } 281 }
277 state = KEY_NAME; 282 state = KEY_NAME;
278 break; 283 break;
279 } 284 }
280 } 285 }
281 return true; 286 return true;
282 } 287 }
283 288
284 } // namespace base 289 } // namespace base
OLDNEW
« no previous file with comments | « no previous file | chrome/app/chrome_dll_main.cc » ('j') | chrome/app/chrome_dll_main.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698