From 8afbb6ca26a8113bb8a7ab39ef967908fd806be8 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Thu, 26 Mar 2015 19:57:37 +0900 Subject: [PATCH] h2load: Fix crash if -t > -c --- src/h2load.cc | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/h2load.cc b/src/h2load.cc index 630d2cae..4eb65ebb 100644 --- a/src/h2load.cc +++ b/src/h2load.cc @@ -1178,6 +1178,12 @@ int main(int argc, char **argv) { 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()) { std::cerr << "-t: warning: the number of threads is greater than hardware " << "cores." << std::endl;