Chromium Code Reviews| Index: runtime/bin/process_linux.cc |
| diff --git a/runtime/bin/process_linux.cc b/runtime/bin/process_linux.cc |
| index a511cd94f53082b3de6513789b59fceed49e8caf..0453ff648b5b25f7aa55e7bc921d2f885e7f0a06 100644 |
| --- a/runtime/bin/process_linux.cc |
| +++ b/runtime/bin/process_linux.cc |
| @@ -378,34 +378,29 @@ class ProcessStarter { |
| private: |
| int CreatePipes() { |
|
Søren Gjesse
2015/04/23 06:58:51
Can't we then get rid of the explicit closing in t
Anders Johnsen
2015/04/23 07:05:34
You are right, it should be safe to remove those.
|
| int result; |
| - result = TEMP_FAILURE_RETRY(pipe(exec_control_)); |
| + result = TEMP_FAILURE_RETRY(pipe2(exec_control_, O_CLOEXEC)); |
| if (result < 0) { |
| return CleanupAndReturnError(); |
| } |
| - FDUtils::SetCloseOnExec(exec_control_[0]); |
| - FDUtils::SetCloseOnExec(exec_control_[1]); |
| // For a detached process the pipe to connect stdout is still used for |
| // signaling when to do the first fork. |
| - result = TEMP_FAILURE_RETRY(pipe(read_in_)); |
| + result = TEMP_FAILURE_RETRY(pipe2(read_in_, O_CLOEXEC)); |
| if (result < 0) { |
| return CleanupAndReturnError(); |
| } |
| - FDUtils::SetCloseOnExec(read_in_[0]); |
| // For detached processes the pipe to connect stderr and stdin are not used. |
| if (mode_ != kDetached) { |
| - result = TEMP_FAILURE_RETRY(pipe(read_err_)); |
| + result = TEMP_FAILURE_RETRY(pipe2(read_err_, O_CLOEXEC)); |
| if (result < 0) { |
| return CleanupAndReturnError(); |
| } |
| - FDUtils::SetCloseOnExec(read_err_[0]); |
| - result = TEMP_FAILURE_RETRY(pipe(write_out_)); |
| + result = TEMP_FAILURE_RETRY(pipe2(write_out_, O_CLOEXEC)); |
| if (result < 0) { |
| return CleanupAndReturnError(); |
| } |
| - FDUtils::SetCloseOnExec(write_out_[1]); |
| } |
| return 0; |
| @@ -526,12 +521,10 @@ class ProcessStarter { |
| int RegisterProcess(pid_t pid) { |
| int result; |
| int event_fds[2]; |
| - result = TEMP_FAILURE_RETRY(pipe(event_fds)); |
| + result = TEMP_FAILURE_RETRY(pipe2(event_fds, O_CLOEXEC)); |
| if (result < 0) { |
| return CleanupAndReturnError(); |
| } |
| - FDUtils::SetCloseOnExec(event_fds[0]); |
| - FDUtils::SetCloseOnExec(event_fds[1]); |
| ProcessInfoList::AddProcess(pid, event_fds[1]); |
| *exit_event_ = event_fds[0]; |