From fb9a7e5995d2e6c2c7f08080201d41fe0f6c4b53 Mon Sep 17 00:00:00 2001 From: Josh Gao Date: Wed, 18 Jan 2017 18:14:17 -0800 Subject: [PATCH] adb: check for and report inotify_init1 failure. Bug: http://b/34396687 Test: mma Change-Id: I55ea84db49017a6533ac54db5072e3e75ba30097 --- adb/adb_auth_host.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/adb/adb_auth_host.cpp b/adb/adb_auth_host.cpp index ec9b1c364..c3f1fe07d 100644 --- a/adb/adb_auth_host.cpp +++ b/adb/adb_auth_host.cpp @@ -388,7 +388,13 @@ static void adb_auth_inotify_update(int fd, unsigned fd_event, void*) { static void adb_auth_inotify_init(const std::set& paths) { LOG(INFO) << "adb_auth_inotify_init..."; + int infd = inotify_init1(IN_CLOEXEC | IN_NONBLOCK); + if (infd < 0) { + PLOG(ERROR) << "failed to create inotify fd"; + return; + } + for (const std::string& path : paths) { int wd = inotify_add_watch(infd, path.c_str(), IN_CREATE | IN_MOVED_TO); if (wd < 0) {