Index: base/process/kill_mac.cc |
diff --git a/base/process/kill_mac.cc b/base/process/kill_mac.cc |
index 1589a641a0484c000b243578a6cb94884e44c158..5ebca5d00762329f5a163a9c8e2878df748f50f6 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 @@ |
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 @@ |
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; |