Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(943)

Unified Diff: base/process/kill_posix.cc

Issue 191673003: Implement ScopedFD in terms of ScopedGeneric. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/process/kill_posix.cc
diff --git a/base/process/kill_posix.cc b/base/process/kill_posix.cc
index 99d70d9ab5590418566be37a047a6aa67ee58247..80f5996c4cebf78b46dba79fda141812db53ec44 100644
--- a/base/process/kill_posix.cc
+++ b/base/process/kill_posix.cc
@@ -273,16 +273,15 @@ static bool WaitForSingleNonChildProcess(ProcessHandle handle,
DCHECK_GT(handle, 0);
DCHECK(wait.InMilliseconds() == base::kNoTimeout || wait > base::TimeDelta());
- int kq = kqueue();
- if (kq == -1) {
+ ScopedFD kq(kqueue());
+ if (!kq) {
DPLOG(ERROR) << "kqueue";
return false;
}
- file_util::ScopedFD kq_closer(&kq);
struct kevent change = {0};
EV_SET(&change, handle, EVFILT_PROC, EV_ADD, NOTE_EXIT, 0, NULL);
- int result = HANDLE_EINTR(kevent(kq, &change, 1, NULL, 0, NULL));
+ int result = HANDLE_EINTR(kevent(kq.get(), &change, 1, NULL, 0, NULL));
if (result == -1) {
if (errno == ESRCH) {
// If the process wasn't found, it must be dead.
@@ -316,7 +315,7 @@ static bool WaitForSingleNonChildProcess(ProcessHandle handle,
remaining_timespec_ptr = &remaining_timespec;
}
- result = kevent(kq, NULL, 0, &event, 1, remaining_timespec_ptr);
+ result = kevent(kq.get(), NULL, 0, &event, 1, remaining_timespec_ptr);
if (result == -1 && errno == EINTR) {
if (!wait_forever) {

Powered by Google App Engine
This is Rietveld 408576698