corrected wrong initial scan loag message

This commit is contained in:
john30
2017-12-17 10:04:52 +01:00
parent 6bba2d6a02
commit ab5c350d24
+16 -18
View File
@@ -303,25 +303,23 @@ error_t parse_opt(int key, char *arg, struct argp_state *state) {
argp_error(state, "scanconfig without polling may lead to invalid files included for certain products!"); argp_error(state, "scanconfig without polling may lead to invalid files included for certain products!");
return EINVAL; return EINVAL;
} }
if (arg != NULL) { if (!arg || arg[0] == 0 || strcmp("none", arg) == 0) {
if (arg[0] == 0 || strcmp("none", arg) == 0) { opt->initialScan = ESC;
opt->initialScan = ESC; } else if (strcmp("full", arg) == 0) {
} else if (strcmp("full", arg) == 0) { opt->initialScan = SYN;
opt->initialScan = SYN; } else {
} else { opt->initialScan = (symbol_t)parseInt(arg, 16, 0x00, 0xff, &result);
opt->initialScan = (symbol_t)parseInt(arg, 16, 0x00, 0xff, &result); if (!isValidAddress(opt->initialScan)) {
if (!isValidAddress(opt->initialScan)) { argp_error(state, "invalid initial scan address");
argp_error(state, "invalid initial scan address");
return EINVAL;
}
if (isMaster(opt->initialScan)) {
opt->initialScan = getSlaveAddress(opt->initialScan);
}
}
if (opt->readOnly && opt->initialScan != ESC) {
argp_error(state, "cannot combine readonly with answer/generatesyn/initsend/scanconfig=*");
return EINVAL; return EINVAL;
} }
if (isMaster(opt->initialScan)) {
opt->initialScan = getSlaveAddress(opt->initialScan);
}
}
if (opt->readOnly && opt->initialScan != ESC) {
argp_error(state, "cannot combine readonly with answer/generatesyn/initsend/scanconfig=*");
return EINVAL;
} }
break; break;
case O_CFGLNG: // --configlang=LANG case O_CFGLNG: // --configlang=LANG
@@ -1191,7 +1189,7 @@ int main(int argc, char* argv[]) {
signal(SIGTERM, signalHandler); signal(SIGTERM, signalHandler);
logNotice(lf_main, PACKAGE_STRING "." REVISION " started%s", logNotice(lf_main, PACKAGE_STRING "." REVISION " started%s",
opt.scanConfig ? opt.initialScan == ESC ? " with scan" : opt.initialScan == BROADCAST ? " with broadcast scan" opt.scanConfig ? opt.initialScan == ESC ? " with auto scan" : opt.initialScan == BROADCAST ? " with broadcast scan"
: opt.initialScan == SYN ? " with full scan" : " with single scan" : ""); : opt.initialScan == SYN ? " with full scan" : " with single scan" : "");
// load configuration files // load configuration files