src/irc.c
changeset 59 e8f15b159e19
parent 58 500a5ea7fcb8
child 60 67a32e9d95f2
equal deleted inserted replaced
58:500a5ea7fcb8 59:e8f15b159e19
    60         if (connect (csocket, rp->ai_addr, rp->ai_addrlen) != -1) {
    60         if (connect (csocket, rp->ai_addr, rp->ai_addrlen) != -1) {
    61             fprintf (stderr, "Connected via %s\n", (rp->ai_family == AF_INET6) ? "IPv6" : "IPv4");
    61             fprintf (stderr, "Connected via %s\n", (rp->ai_family == AF_INET6) ? "IPv6" : "IPv4");
    62             break;
    62             break;
    63         }
    63         }
    64         close (csocket);
    64         close (csocket);
       
    65         csocket = -1;
    65     }
    66     }
    66 
    67 
    67     if (result != NULL)
    68     if (result != NULL)
    68         freeaddrinfo (result);
    69         freeaddrinfo (result);
    69 
    70 
    70     if (csocket < 0) {
    71     if (csocket == -1) {
    71         perror ("Cannot connect");
    72         perror ("Cannot connect");
    72         return NULL;
    73         return NULL;
    73     }
    74     }
    74 
    75 
    75     /*
    76     /*