kevent(2): Set errno properly
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 23 Sep 2011 01:51:05 +0000 (09:51 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Fri, 23 Sep 2011 02:00:14 +0000 (10:00 +0800)
If we can't deliver the registration failure information in the
changelist, then we should set the errno properly.

sys/kern/kern_event.c

index 0c4c30c..bd5ac9a 100644 (file)
@@ -625,7 +625,9 @@ kern_kevent(struct kqueue *kq, int nevents, int *res, void *uap,
                                kevp->data = error;
                                lres = *res;
                                kevent_copyoutfn(uap, kevp, 1, res);
-                               if (lres != *res) {
+                               if (*res < 0) {
+                                       goto done;
+                               } else if (lres != *res) {
                                        nevents--;
                                        nerrors++;
                                }