- return correct errno in NETConnectFinished

This commit is contained in:
zolliker
2012-06-19 07:05:41 +00:00
parent 8a817c5e30
commit bf04c301ca

View File

@ -319,7 +319,8 @@ int NETConnectFinished(mkChannel * self)
struct timeval tmo = { 0, 0 }; struct timeval tmo = { 0, 0 };
int iret; int iret;
int oldopts; int oldopts;
int olderrno;
if (self->sockid == 0) { if (self->sockid == 0) {
errno = ENOTCONN; errno = ENOTCONN;
return -1; return -1;
@ -357,7 +358,9 @@ int NETConnectFinished(mkChannel * self)
} }
} }
/* reset to blocking mode */ /* reset to blocking mode */
olderrno = errno;
fcntl(self->sockid, F_SETFL, oldopts | ~O_NONBLOCK); fcntl(self->sockid, F_SETFL, oldopts | ~O_NONBLOCK);
errno = olderrno;
return iret; return iret;
} }