Index: base/process/launch_posix.cc |
diff --git a/base/process/launch_posix.cc b/base/process/launch_posix.cc |
index 79e74d5877dbd5baa856729555ee707925f393b6..84a05d61105e9b0cd4980fb66724e09a3887c3ae 100644 |
--- a/base/process/launch_posix.cc |
+++ b/base/process/launch_posix.cc |
@@ -26,7 +26,6 @@ |
#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" |
@@ -333,13 +332,14 @@ |
// 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. |
- base::ScopedFD null_fd(HANDLE_EINTR(open("/dev/null", O_RDONLY))); |
- if (!null_fd.is_valid()) { |
+ int null_fd = HANDLE_EINTR(open("/dev/null", O_RDONLY)); |
+ if (null_fd < 0) { |
RAW_LOG(ERROR, "Failed to open /dev/null"); |
_exit(127); |
} |
- int new_fd = HANDLE_EINTR(dup2(null_fd.get(), STDIN_FILENO)); |
+ file_util::ScopedFD null_fd_closer(&null_fd); |
+ int new_fd = HANDLE_EINTR(dup2(null_fd, STDIN_FILENO)); |
if (new_fd != STDIN_FILENO) { |
RAW_LOG(ERROR, "Failed to dup /dev/null for stdin"); |
_exit(127); |