From: Po Lu Date: Fri, 19 Jan 2024 12:51:24 +0000 (+0800) Subject: Fix another cause of superfluous inotify signals on Android X-Git-Tag: archive/raspbian/1%30.1+1-3+rpi1^2~2^2~20^2~2898 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=bd5bfc29137b6e452e1900a1fc3cf09e77959133;p=emacs.git Fix another cause of superfluous inotify signals on Android * src/android.c (android_select): If the event queue isn't empty upon the initial check, clear all fdsets. --- diff --git a/src/android.c b/src/android.c index 757f256c188..fb7703d84ab 100644 --- a/src/android.c +++ b/src/android.c @@ -744,6 +744,19 @@ android_select (int nfds, fd_set *readfds, fd_set *writefds, if (event_queue.num_events) { + /* Zero READFDS, WRITEFDS and EXCEPTFDS, lest the caller + mistakenly interpret this return value as indicating that an + inotify file descriptor is readable, and try to poll an + unready one. */ + + if (readfds) + FD_ZERO (readfds); + + if (writefds) + FD_ZERO (writefds); + + if (exceptfds) + FD_ZERO (exceptfds); pthread_mutex_unlock (&event_queue.mutex); return 1; }