udp/usrreq: Add brackets properly
authorSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 29 Oct 2015 01:20:29 +0000 (09:20 +0800)
committerSepherosa Ziehau <sephe@dragonflybsd.org>
Thu, 29 Oct 2015 01:26:02 +0000 (09:26 +0800)
The brackets were left out pretty accidentally, but the code
also worked pretty accidentally:

int error = 0;

if (ai != NULL)
    error = udp_preattach(...);

if (error)
    goto out
else {
    /* mismatched comment */
}

Reported-by: s4 on DragonFlyDigest
sys/netinet/udp_usrreq.c

index 4f18c29..fbb30d4 100644 (file)
@@ -1211,15 +1211,15 @@ udp_attach(netmsg_t msg)
        struct socket *so = msg->attach.base.nm_so;
        struct pru_attach_info *ai = msg->attach.nm_ai;
        struct inpcb *inp;
-       int error = 0;
+       int error;
 
        KASSERT(so->so_pcb == NULL, ("udp socket attached"));
 
-       if (ai != NULL)
+       if (ai != NULL) {
                error = udp_preattach(so, 0 /* don't care */, ai);
                if (error)
                        goto out;
-       else {
+       else {
                /* Post attach; do nothing */
        }