Merge "adb: check for and report inotify_init1 failure."

am: 41ee55a875

Change-Id: I5454f46e519aa7b9660f1ec98f445e6d820808e0
This commit is contained in:
Josh Gao 2017-01-21 01:10:05 +00:00 committed by android-build-merger
commit 95a3a2fc3d
1 changed files with 6 additions and 0 deletions

View File

@ -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<std::string>& 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) {