Fix block size evaluation (#1212) (#1213)

* Fix block size evaluation (#1212)
This commit is contained in:
Uwe Seimet 2023-10-01 23:50:30 +02:00 committed by GitHub
parent 84c20c4f29
commit bd9b776c47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -157,7 +157,6 @@ void Piscsi::TerminationHandler(int)
Piscsi::optargs_type Piscsi::ParseArguments(const vector<char *>& args, int& port) const
{
optargs_type optargs;
int block_size = 0;
string name;
opterr = 1;
@ -168,6 +167,7 @@ Piscsi::optargs_type Piscsi::ParseArguments(const vector<char *>& args, int& por
// the 'bus' object is created and configured
case 'i':
case 'I':
case 'b':
case 'd':
case 'D':
case 'R':
@ -182,13 +182,6 @@ Piscsi::optargs_type Piscsi::ParseArguments(const vector<char *>& args, int& por
continue;
}
case 'b': {
if (!GetAsUnsignedInt(optarg, block_size)) {
throw parser_exception("Invalid block size " + string(optarg));
}
continue;
}
case 'L':
current_log_level = optarg;
continue;
@ -220,7 +213,7 @@ Piscsi::optargs_type Piscsi::ParseArguments(const vector<char *>& args, int& por
}
if (optopt) {
throw parser_exception("Praser error");
throw parser_exception("Parser error");
}
}
@ -253,6 +246,12 @@ void Piscsi::CreateInitialDevices(const optargs_type& optargs) const
id_and_lun = value;
continue;
case 'b':
if (!GetAsUnsignedInt(value, block_size)) {
throw parser_exception("Invalid block size " + value);
}
continue;
case 'z':
locale = value.c_str();
continue;