~mdw
/
sgt
/
putty
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Centralise calls to fcntl into functions that carefully check the
[sgt/putty]
/
unix
/
uxnet.c
diff --git
a/unix/uxnet.c
b/unix/uxnet.c
index
e951524
..
02894bd
100644
(file)
--- a/
unix/uxnet.c
+++ b/
unix/uxnet.c
@@
-540,7
+540,7
@@
static int try_connect(Actual_Socket sock)
const union sockaddr_union *sa;
int err = 0;
short localport;
const union sockaddr_union *sa;
int err = 0;
short localport;
- int
fl,
salen, family;
+ int salen, family;
/*
* Remove the socket from the tree before we overwrite its
/*
* Remove the socket from the tree before we overwrite its
@@
-695,9
+695,7
@@
static int try_connect(Actual_Socket sock)
exit(1); /* XXX: GCC doesn't understand assert() on some systems. */
}
exit(1); /* XXX: GCC doesn't understand assert() on some systems. */
}
- fl = fcntl(s, F_GETFL);
- if (fl != -1)
- fcntl(s, F_SETFL, fl | O_NONBLOCK);
+ nonblock(s);
if ((connect(s, &(sa->sa), salen)) < 0) {
if ( errno != EINPROGRESS ) {
if ((connect(s, &(sa->sa), salen)) < 0) {
if ( errno != EINPROGRESS ) {
@@
-1255,7
+1253,6
@@
static int net_select_result(int fd, int event)
union sockaddr_union su;
socklen_t addrlen = sizeof(su);
int t; /* socket of connection */
union sockaddr_union su;
socklen_t addrlen = sizeof(su);
int t; /* socket of connection */
- int fl;
memset(&su, 0, addrlen);
t = accept(s->s, &su.sa, &addrlen);
memset(&su, 0, addrlen);
t = accept(s->s, &su.sa, &addrlen);
@@
-1263,9
+1260,7
@@
static int net_select_result(int fd, int event)
break;
}
break;
}
- fl = fcntl(t, F_GETFL);
- if (fl != -1)
- fcntl(t, F_SETFL, fl | O_NONBLOCK);
+ nonblock(t);
if (s->localhost_only &&
!sockaddr_is_loopback(&su.sa)) {
if (s->localhost_only &&
!sockaddr_is_loopback(&su.sa)) {