]> git.saurik.com Git - apple/xnu.git/blobdiff - bsd/kern/uipc_socket.c
xnu-6153.81.5.tar.gz
[apple/xnu.git] / bsd / kern / uipc_socket.c
index dc2bd511cc9d8db0d9e33ce5440059328d8667cb..4ab504c31dfe11db61b4d880da0dddaa86ae705b 100644 (file)
@@ -826,12 +826,11 @@ socreate_internal(int dom, struct socket **aso, int type, int proto,
 
        switch (dom) {
        /*
-        * Don't mark Unix domain, system or multipath sockets as
+        * Don't mark Unix domain or system
         * eligible for defunct by default.
         */
        case PF_LOCAL:
        case PF_SYSTEM:
-       case PF_MULTIPATH:
                so->so_flags |= SOF_NODEFUNCT;
                break;
        default:
@@ -1728,6 +1727,9 @@ soconnectlock(struct socket *so, struct sockaddr *nam, int dolock)
                } else {
                        error = (*so->so_proto->pr_usrreqs->pru_connect)
                            (so, nam, p);
+                       if (error != 0) {
+                               so->so_state &= ~SS_ISCONNECTING;
+                       }
                }
        }
        if (dolock) {
@@ -1827,6 +1829,9 @@ soconnectxlocked(struct socket *so, struct sockaddr *src,
                        error = (*so->so_proto->pr_usrreqs->pru_connectx)
                            (so, src, dst, p, ifscope, aid, pcid,
                            flags, arg, arglen, auio, bytes_written);
+                       if (error != 0) {
+                               so->so_state &= ~SS_ISCONNECTING;
+                       }
                }
        }
 
@@ -7084,7 +7089,7 @@ solockhistory_nr(struct socket *so)
 
        bzero(lock_history_str, sizeof(lock_history_str));
        for (i = SO_LCKDBG_MAX - 1; i >= 0; i--) {
-               n += snprintf(lock_history_str + n,
+               n += scnprintf(lock_history_str + n,
                    SO_LOCK_HISTORY_STR_LEN - n, "%p:%p ",
                    so->lock_lr[(so->next_lock_lr + i) % SO_LCKDBG_MAX],
                    so->unlock_lr[(so->next_unlock_lr + i) % SO_LCKDBG_MAX]);