- if(connect(fd, sa, salen) < 0) {
- byte_xasprintf((char **)&c->last, "connect: %s", strerror(errno));
- disorder_error(errno, "error calling connect");
- goto error;
- }
- if((fd2 = dup(fd)) < 0) {
- byte_xasprintf((char **)&c->last, "dup: %s", strerror(errno));
- disorder_error(errno, "error calling dup");
- goto error;
- }
- if(!(c->fpin = fdopen(fd, "rb"))) {
- byte_xasprintf((char **)&c->last, "fdopen: %s", strerror(errno));
- disorder_error(errno, "error calling fdopen");
- goto error;
- }
- fd = -1;
- if(!(c->fpout = fdopen(fd2, "wb"))) {
- byte_xasprintf((char **)&c->last, "fdopen: %s", strerror(errno));
- disorder_error(errno, "error calling fdopen");
+ c->family = sa->sa_family;
+ if(connect(sd, sa, salen) < 0) {
+ byte_xasprintf((char **)&c->last, "connect: %s",
+ format_error(ec_socket, socket_error(), errbuf, sizeof errbuf));
+ disorder_error(0, "%s", c->last);