1
0
mirror of https://github.com/nmap/nmap.git synced 2026-01-05 22:19:03 +00:00

Use the right errno in handle_connect_result catch-all assert.

We call getsockopt(SO_ERROR) to get the socket error, but then we were
calling perror, which uses the global errno instead.
This commit is contained in:
david
2012-01-19 00:03:40 +00:00
parent 47ee706a4a
commit df3b01e5d8

View File

@@ -312,7 +312,6 @@ static int iod_add_event(msiod *iod, msevent *nse) {
void handle_connect_result(mspool *ms, msevent *nse, enum nse_status status) {
int optval;
socklen_t optlen = sizeof(int);
char buf[1024];
msiod *iod = nse->iod;
#if HAVE_OPENSSL
int sslerr;
@@ -360,9 +359,8 @@ void handle_connect_result(mspool *ms, msevent *nse, enum nse_status status) {
nse->errnum = optval;
break;
default:
Snprintf(buf, sizeof(buf), "Strange connect error from %s (%d)",
inet_ntop_ez(&iod->peer, iod->peerlen), optval);
perror(buf);
fprintf(stderr, "Strange connect error from %s (%d): %s",
inet_ntop_ez(&iod->peer, iod->peerlen), optval, socket_strerror(optval));
assert(0); /* I'd like for someone to report it */
break;
}