1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-20 22:49:01 +00:00

Removed occurences of `assert(0);'

Replaced them with `fatal()' so that nsock can compile w/ NDEBUG.
This commit is contained in:
henri
2013-07-31 18:46:57 +00:00
parent 8572c85d0b
commit 098c64a1de
2 changed files with 14 additions and 18 deletions

View File

@@ -361,12 +361,12 @@ void handle_connect_result(mspool *ms, msevent *nse, enum nse_status status) {
nse->status = NSE_STATUS_ERROR; nse->status = NSE_STATUS_ERROR;
nse->errnum = optval; nse->errnum = optval;
break; break;
default: default:
fprintf(stderr, "Strange connect error from %s (%d): %s", /* I'd like for someone to report it */
inet_ntop_ez(&iod->peer, iod->peerlen), optval, fatal("Strange connect error from %s (%d): %s",
socket_strerror(optval)); inet_ntop_ez(&iod->peer, iod->peerlen), optval,
assert(0); /* I'd like for someone to report it */ socket_strerror(optval));
break;
} }
/* Now special code for the SSL case where the TCP connection was successful. */ /* Now special code for the SSL case where the TCP connection was successful. */
@@ -391,9 +391,9 @@ void handle_connect_result(mspool *ms, msevent *nse, enum nse_status status) {
/* Associate our new SSL with the connected socket. It will inherit the /* Associate our new SSL with the connected socket. It will inherit the
* non-blocking nature of the sd */ * non-blocking nature of the sd */
if (SSL_set_fd(iod->ssl, iod->sd) != 1) { if (SSL_set_fd(iod->ssl, iod->sd) != 1)
fatal("SSL_set_fd failed: %s", ERR_error_string(ERR_get_error(), NULL)); fatal("SSL_set_fd failed: %s", ERR_error_string(ERR_get_error(), NULL));
}
/* Event not done -- need to do SSL connect below */ /* Event not done -- need to do SSL connect below */
nse->sslinfo.ssl_desire = SSL_ERROR_WANT_CONNECT; nse->sslinfo.ssl_desire = SSL_ERROR_WANT_CONNECT;
#endif #endif
@@ -403,7 +403,7 @@ void handle_connect_result(mspool *ms, msevent *nse, enum nse_status status) {
nse->event_done = 1; nse->event_done = 1;
} }
} else { } else {
assert(0); /* Currently we only know about TIMEOUT and SUCCESS callbacks */ fatal("Unknown status (%d)", status);
} }
/* At this point the TCP connection is done, whether successful or not. /* At this point the TCP connection is done, whether successful or not.
@@ -781,12 +781,11 @@ void handle_read_result(mspool *ms, msevent *nse, enum nse_status status) {
/* Else we are not done */ /* Else we are not done */
break; break;
default: default:
assert(0); fatal("Unknown operation type (%d)", (int)nse->readinfo.read_type);
break; /* unreached */
} }
} }
} else { } else {
assert(0); /* Currently we only know about TIMEOUT, CANCELLED, and SUCCESS callbacks */ fatal("Unknown status (%d)", status);
} }
/* If there are no more reads for this IOD, we are done reading on the socket /* If there are no more reads for this IOD, we are done reading on the socket
@@ -832,8 +831,7 @@ void handle_pcap_read_result(mspool *ms, msevent *nse, enum nse_status status) {
break; break;
default: default:
/* Currently we only know about TIMEOUT, CANCELLED, and SUCCESS callbacks */ fatal("Unknown status (%d) for nsock event #%lu", status, nse->id);
assert(0);
} }
/* If there are no more read events, we are done reading on the socket so we /* If there are no more read events, we are done reading on the socket so we
@@ -1227,8 +1225,7 @@ void nsp_add_event(mspool *nsp, msevent *nse) {
#endif #endif
default: default:
assert(0); fatal("Unknown nsock event type (%d)", nse->type);
break; /* unreached */
} }
} }
@@ -1305,8 +1302,7 @@ void nsock_trace_handler_callback(mspool *ms, msevent *nse) {
#endif #endif
default: default:
assert(0); fatal("Invalid nsock event type (%d)", nse->type);
break;
} }
} }

View File

@@ -286,7 +286,7 @@ int msevent_cancel(mspool *nsp, msevent *nse, gh_list *event_list, gh_list_elem
#endif #endif
default: default:
assert(0); fatal("Invalid nsock event type (%d)", nse->type);
} }
assert(nse->event_done); assert(nse->event_done);