kqueue: Fix typo in filt_userattach function: kn_fflags vs. kn_sfflags.
authorImre Vadász <imre@vdsz.com>
Sat, 19 Aug 2017 17:03:32 +0000 (19:03 +0200)
committerImre Vadász <imre@vdsz.com>
Sat, 19 Aug 2017 21:12:47 +0000 (23:12 +0200)
* This typo meant that adding an EVFILT_USER event with NOTE_TRIGGER already
  set, would fail to trigger the user event.

* So far I didn't find any EVFILT_USER usages in opensource code, where
  the NOTE_TRIGGER flag is set when adding the EVFILT_USER event, so this
  fix seems to be a cornercase in practice.

sys/kern/kern_event.c

index e6dcdc8..5d24979 100644 (file)
@@ -522,7 +522,7 @@ static int
 filt_userattach(struct knote *kn)
 {
        kn->kn_hook = NULL;
-       if (kn->kn_fflags & NOTE_TRIGGER)
+       if (kn->kn_sfflags & NOTE_TRIGGER)
                kn->kn_ptr.hookid = 1;
        else
                kn->kn_ptr.hookid = 0;