1
0
mirror of https://github.com/nmap/nmap.git synced 2025-12-22 15:39:03 +00:00

Don't fatal() in nsock_set_default_engine()

Return negative value instead. Moved the fatal() statement to nmap.cc
This commit is contained in:
henri
2012-10-21 22:56:53 +00:00
parent 5aaf80a0b9
commit e76d41fa04
3 changed files with 13 additions and 10 deletions

View File

@@ -107,7 +107,7 @@ struct io_engine *get_io_engine(void) {
return engine;
}
void nsock_set_default_engine(char *engine) {
int nsock_set_default_engine(char *engine) {
if (engine_hint)
free(engine_hint);
@@ -117,15 +117,15 @@ void nsock_set_default_engine(char *engine) {
for (i = 0; available_engines[i] != NULL; i++) {
if (strcmp(engine, available_engines[i]->name) == 0) {
engine_hint = strdup(engine);
return;
return 0;
}
}
fatal("Unknown or non-available IO engine: %s\n", engine);
} else {
/* having engine = NULL is fine. This is actually the
* way to tell nsock to use the default engine again. */
engine_hint = NULL;
return -1;
}
/* having engine = NULL is fine. This is actually the
* way to tell nsock to use the default engine again. */
engine_hint = NULL;
return 0;
}
const char *nsock_list_engines(void) {