From f187715954c15d90b65b251459244c2442c04a7b Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Fri, 11 May 2018 08:25:28 -0700 Subject: [PATCH] init: keychord inotify add IN_ONLYDIR some minor cleanup. Test: manual, boot, check registered chord works Bug: 64114943 Change-Id: If809075445cfd5b6de0d4debc42cdc9559ddc7c4 --- init/keychords.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init/keychords.cpp b/init/keychords.cpp index 10c56e311..293736d30 100644 --- a/init/keychords.cpp +++ b/init/keychords.cpp @@ -276,7 +276,7 @@ void GeteventOpenDevice() { inotify_fd = ::inotify_init1(IN_NONBLOCK | IN_CLOEXEC); if (inotify_fd < 0) { PLOG(WARNING) << "Could not instantiate inotify for " << kDevicePath; - } else if (::inotify_add_watch(inotify_fd, kDevicePath, IN_DELETE | IN_CREATE) < 0) { + } else if (::inotify_add_watch(inotify_fd, kDevicePath, IN_DELETE | IN_CREATE | IN_ONLYDIR) < 0) { PLOG(WARNING) << "Could not add watch for " << kDevicePath; ::close(inotify_fd); inotify_fd = -1;