ndis_events(8): Handle the "no event matched" case (fixes a gcc41 warning).
authorSascha Wildner <saw@online.de>
Mon, 12 Dec 2011 18:11:01 +0000 (19:11 +0100)
committerSascha Wildner <saw@online.de>
Mon, 12 Dec 2011 18:24:21 +0000 (19:24 +0100)
usr.sbin/802_11/ndis_events/ndis_events.c

index 76797e8..7cab62c 100644 (file)
@@ -203,8 +203,7 @@ announce_event(char *ifname, int sock, struct sockaddr_in *dst)
                        close(s);
                        return(0);
                }
-       }
-       if (e->ne_sts == NDIS_STATUS_MEDIA_DISCONNECT) {
+       } else if (e->ne_sts == NDIS_STATUS_MEDIA_DISCONNECT) {
                type = EVENT_DISCONNECT;
                if (verbose)
                        dbgmsg("Received a disconnect event for %s", ifname);
@@ -212,12 +211,14 @@ announce_event(char *ifname, int sock, struct sockaddr_in *dst)
                        close(s);
                        return(0);
                }
-       }
-       if (e->ne_sts == NDIS_STATUS_MEDIA_SPECIFIC_INDICATION) {
+       } else if (e->ne_sts == NDIS_STATUS_MEDIA_SPECIFIC_INDICATION) {
                type = EVENT_MEDIA_SPECIFIC;
                if (verbose)
                        dbgmsg("Received a media-specific event for %s",
                            ifname);
+       } else {
+               dbgmsg("unknown event %u\n", e->ne_sts);
+               return(EINVAL);
        }
 
        end = buf + sizeof(buf);