chiark
/
gitweb
/
~mdw
/
mLib
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f128ce7
)
Finish the work.
author
mdw
<mdw>
Sun, 12 Oct 2003 14:54:00 +0000
(14:54 +0000)
committer
mdw
<mdw>
Sun, 12 Oct 2003 14:54:00 +0000
(14:54 +0000)
conn.c
patch
|
blob
|
blame
|
history
diff --git
a/conn.c
b/conn.c
index e734f30459c0e0aa521f2fbd2580520b5e8b9853..1478fade1edc4178059286cfcd03eb5da8d487c6 100644
(file)
--- a/
conn.c
+++ b/
conn.c
@@
-1,6
+1,6
@@
/* -*-c-*-
*
/* -*-c-*-
*
- * $Id: conn.c,v 1.
8 2003/10/12 14:47:1
0 mdw Exp $
+ * $Id: conn.c,v 1.
9 2003/10/12 14:54:0
0 mdw Exp $
*
* Nonblocking connect handling
*
*
* Nonblocking connect handling
*
@@
-30,6
+30,9
@@
/*----- Revision history --------------------------------------------------*
*
* $Log: conn.c,v $
/*----- 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.
*
* Revision 1.8 2003/10/12 14:47:10 mdw
* New interface for messing with preconnected sockets.
*
@@
-167,10
+170,8
@@
int conn_init(conn *c, sel_state *s, int fd,
{
int f;
{
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);
if (!connect(fd, dst, dsz))
func(fd, p);
@@
-179,6
+180,10
@@
int conn_init(conn *c, sel_state *s, int fd,
else
conn_fd(c, s, fd, func, p);
return (0);
else
conn_fd(c, s, fd, func, p);
return (0);
+
+fail:
+ close(fd);
+ return (-1);
}
/* --- @conn_kill@ --- *
}
/* --- @conn_kill@ --- *