diff options
Diffstat (limited to 'base/process/kill_mac.cc')
-rw-r--r-- | base/process/kill_mac.cc | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/base/process/kill_mac.cc b/base/process/kill_mac.cc index 1589a64..5ebca5d 100644 --- a/base/process/kill_mac.cc +++ b/base/process/kill_mac.cc @@ -10,7 +10,6 @@ #include <sys/wait.h> #include "base/file_util.h" -#include "base/files/scoped_file.h" #include "base/logging.h" #include "base/posix/eintr_wrapper.h" @@ -77,13 +76,15 @@ void WaitForChildToDie(pid_t child, int timeout) { int result; - ScopedFD kq(HANDLE_EINTR(kqueue())); - if (!kq.is_valid()) { + int kq = HANDLE_EINTR(kqueue()); + if (kq == -1) { DPLOG(ERROR) << "kqueue()"; } else { + file_util::ScopedFD auto_close_kq(&kq); + struct kevent change = {0}; EV_SET(&change, child, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL); - result = HANDLE_EINTR(kevent(kq.get(), &change, 1, NULL, 0, NULL)); + result = HANDLE_EINTR(kevent(kq, &change, 1, NULL, 0, NULL)); if (result == -1) { if (errno != ESRCH) { @@ -119,7 +120,7 @@ void WaitForChildToDie(pid_t child, int timeout) { struct kevent event = {0}; while (remaining_delta.InMilliseconds() > 0) { const struct timespec remaining_timespec = remaining_delta.ToTimeSpec(); - result = kevent(kq.get(), NULL, 0, &event, 1, &remaining_timespec); + result = kevent(kq, NULL, 0, &event, 1, &remaining_timespec); if (result == -1 && errno == EINTR) { remaining_delta = deadline - TimeTicks::Now(); result = 0; |