h2load: Fix crash if -t > -c

This commit is contained in:
Tatsuhiro Tsujikawa 2015-03-26 19:57:37 +09:00
parent ed79637737
commit 8afbb6ca26
1 changed files with 6 additions and 0 deletions

View File

@ -1178,6 +1178,12 @@ int main(int argc, char **argv) {
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
if (config.nclients < config.nthreads) {
std::cerr << "-c, -t: the number of client must be greater than or equal "
"to the number of threads." << std::endl;
exit(EXIT_FAILURE);
}
if (config.nthreads > std::thread::hardware_concurrency()) { if (config.nthreads > std::thread::hardware_concurrency()) {
std::cerr << "-t: warning: the number of threads is greater than hardware " std::cerr << "-t: warning: the number of threads is greater than hardware "
<< "cores." << std::endl; << "cores." << std::endl;