diff --git a/python2/pyinotify.py b/python2/pyinotify.py index d2f0816..3645b66 100755 --- a/python2/pyinotify.py +++ b/python2/pyinotify.py @@ -1228,7 +1228,9 @@ def read_events(self): """ buf_ = array.array('i', [0]) # get event queue size - if fcntl.ioctl(self._fd, termios.FIONREAD, buf_, 1) == -1: + # don't pass `mutate_flag` to the `fcntl.ioctl`, it may cause segfault on some + # systems, e.g. alpine linux (see https://bugs.alpinelinux.org/issues/5981) + if fcntl.ioctl(self._fd, termios.FIONREAD, buf_) == -1: return queue_size = buf_[0] if queue_size < self._threshold: