Index: base/process/launch_posix.cc |
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc |
index 84a05d61105e9b0cd4980fb66724e09a3887c3ae..5bfdde209f8b5f272a15b322b1abcd85a95cc860 100644 |
--- a/base/process/launch_posix.cc |
+++ b/base/process/launch_posix.cc |
@@ -26,6 +26,7 @@ |
#include "base/debug/stack_trace.h" |
#include "base/file_util.h" |
#include "base/files/dir_reader_posix.h" |
+#include "base/files/scoped_file.h" |
#include "base/logging.h" |
#include "base/memory/scoped_ptr.h" |
#include "base/posix/eintr_wrapper.h" |
@@ -332,14 +333,13 @@ bool LaunchProcess(const std::vector<std::string>& argv, |
// If a child process uses the readline library, the process block forever. |
// In BSD like OSes including OS X it is safe to assign /dev/null as stdin. |
// See http://crbug.com/56596. |
- int null_fd = HANDLE_EINTR(open("/dev/null", O_RDONLY)); |
- if (null_fd < 0) { |
+ base::ScopedFD null_fd(HANDLE_EINTR(open("/dev/null", O_RDONLY))); |
+ if (!null_fd) { |
RAW_LOG(ERROR, "Failed to open /dev/null"); |
_exit(127); |
} |
- file_util::ScopedFD null_fd_closer(&null_fd); |
- int new_fd = HANDLE_EINTR(dup2(null_fd, STDIN_FILENO)); |
+ int new_fd = HANDLE_EINTR(dup2(null_fd.get(), STDIN_FILENO)); |
if (new_fd != STDIN_FILENO) { |
RAW_LOG(ERROR, "Failed to dup /dev/null for stdin"); |
_exit(127); |