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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user