fix select breakage due to unhandled null last in socket_check and notify_dispatch
@@ -123,7 +123,8 @@ static void notify_dispatch(sock s)
notify_entry n = struct_from_list(l, notify_entry, l);
list next = list_get_next(l);
u32 masked = events & n->eventmask;
- u32 r = edge_events(masked, n->eventmask, *n->last);
+ u32 r = edge_events(masked, n->eventmask, n->last ? *n->last : 0);
+ if (n->last)
*n->last = masked;
if (r && apply(n->eh, r)) {
list_delete(l);
@@ -355,7 +356,8 @@ static boolean socket_check(sock s, u32 eventmask, u32 * last, event_handler eh)
net_debug("sock %d, type %d, eventmask %P, events %P\n",
s->fd, s->type, eventmask, events);
if (masked) {
- u32 report = edge_events(masked, eventmask, *last);
+ u32 report = edge_events(masked, eventmask, last ? *last : 0);
+ if (last)
*last = masked;
return apply(eh, report);
} else {
