OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/launch.h" | 5 #include "base/process/launch.h" |
6 | 6 |
7 #include <dirent.h> | 7 #include <dirent.h> |
8 #include <errno.h> | 8 #include <errno.h> |
9 #include <fcntl.h> | 9 #include <fcntl.h> |
10 #include <sched.h> | 10 #include <sched.h> |
(...skipping 498 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
509 #endif | 509 #endif |
510 if (!options.allow_new_privs) { | 510 if (!options.allow_new_privs) { |
511 if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) && errno != EINVAL) { | 511 if (prctl(PR_SET_NO_NEW_PRIVS, 1, 0, 0, 0) && errno != EINVAL) { |
512 // Only log if the error is not EINVAL (i.e. not supported). | 512 // Only log if the error is not EINVAL (i.e. not supported). |
513 RAW_LOG(FATAL, "prctl(PR_SET_NO_NEW_PRIVS) failed"); | 513 RAW_LOG(FATAL, "prctl(PR_SET_NO_NEW_PRIVS) failed"); |
514 } | 514 } |
515 } | 515 } |
516 #endif | 516 #endif |
517 | 517 |
518 #if defined(OS_POSIX) | 518 #if defined(OS_POSIX) |
519 if (!options.current_directory.empty()) { | |
520 RAW_CHECK(chdir(options.current_directory.value().c_str()) == 0); | |
jln (very slow on Chromium)
2015/02/03 02:07:53
Sorry I didn't comment on that before: you need to
rickyz (no longer on Chrome)
2015/02/03 02:17:56
Sure, I moved another c_str caller up as well.
| |
521 } | |
522 | |
519 if (options.pre_exec_delegate != nullptr) { | 523 if (options.pre_exec_delegate != nullptr) { |
520 options.pre_exec_delegate->RunAsyncSafe(); | 524 options.pre_exec_delegate->RunAsyncSafe(); |
521 } | 525 } |
522 #endif | 526 #endif |
523 | 527 |
524 for (size_t i = 0; i < argv.size(); i++) | 528 for (size_t i = 0; i < argv.size(); i++) |
525 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); | 529 argv_cstr[i] = const_cast<char*>(argv[i].c_str()); |
526 argv_cstr[argv.size()] = NULL; | 530 argv_cstr[argv.size()] = NULL; |
527 execvp(argv_cstr[0], argv_cstr.get()); | 531 execvp(argv_cstr[0], argv_cstr.get()); |
528 | 532 |
(...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
759 jmp_buf env; | 763 jmp_buf env; |
760 if (setjmp(env) == 0) { | 764 if (setjmp(env) == 0) { |
761 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); | 765 return CloneAndLongjmpInChild(flags, ptid, ctid, &env); |
762 } | 766 } |
763 | 767 |
764 return 0; | 768 return 0; |
765 } | 769 } |
766 #endif // defined(OS_LINUX) | 770 #endif // defined(OS_LINUX) |
767 | 771 |
768 } // namespace base | 772 } // namespace base |
OLD | NEW |