/* -*-c-*-
*
- * $Id: conn.c,v 1.8 2003/10/12 14:47:10 mdw Exp $
+ * $Id: conn.c,v 1.9 2003/10/12 14:54:00 mdw Exp $
*
* Nonblocking connect handling
*
/*----- Revision history --------------------------------------------------*
*
* $Log: conn.c,v $
+ * Revision 1.9 2003/10/12 14:54:00 mdw
+ * Finish the work.
+ *
* Revision 1.8 2003/10/12 14:47:10 mdw
* New interface for messing with preconnected sockets.
*
{
int f;
- if ((f = fcntl(fd, F_GETFL)) < 0 || fcntl(fd, F_SETFL, f | O_NONBLOCK)) {
- close(fd);
- return (-1);
- }
+ if ((f = fcntl(fd, F_GETFL)) < 0 || fcntl(fd, F_SETFL, f | O_NONBLOCK))
+ goto fail;
if (!connect(fd, dst, dsz))
func(fd, p);
else
conn_fd(c, s, fd, func, p);
return (0);
+
+fail:
+ close(fd);
+ return (-1);
}
/* --- @conn_kill@ --- *