#include <mem_config.h>
#include <cassert>
+#include <cerrno>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <sys/stat.h>
#include <sys/time.h>
#include <sys/types.h>
-#include <sys/types.h>
#include <unistd.h>
#include <iostream>
{
opt_servers= strdup(temp);
}
- else
+
+ if (opt_servers == NULL)
{
- fprintf(stderr, "No Servers provided\n");
- return EXIT_FAILURE;
+ std::cerr << "No Servers provided" << std::endl;
+ exit(EXIT_FAILURE);
}
}
memcached_server_st *servers= memcached_servers_parse(opt_servers);
+ if (servers == NULL or memcached_server_list_count(servers) == 0)
+ {
+ std::cerr << "Invalid server list provided:" << opt_servers << std::endl;
+ return EXIT_FAILURE;
+ }
pthread_mutex_init(&sleeper_mutex, NULL);
pthread_cond_init(&sleep_threshhold, NULL);
break;
case OPT_SLAP_CONCURRENCY:
+ errno= 0;
opt_concurrency= (unsigned int)strtoul(optarg, (char **)NULL, 10);
+ if (errno != 0)
+ {
+ fprintf(stderr, "Invalid value for concurrency: %s\n", optarg);
+ exit(EXIT_FAILURE);
+ }
break;
case OPT_SLAP_EXECUTE_NUMBER:
+ errno= 0;
opt_execute_number= (unsigned int)strtoul(optarg, (char **)NULL, 10);
+ if (errno != 0)
+ {
+ fprintf(stderr, "Invalid value for execute: %s\n", optarg);
+ exit(EXIT_FAILURE);
+ }
break;
case OPT_SLAP_INITIAL_LOAD:
+ errno= 0;
opt_createial_load= (unsigned int)strtoul(optarg, (char **)NULL, 10);
+ if (errno != 0)
+ {
+ fprintf(stderr, "Invalid value for initial load: %s\n", optarg);
+ exit(EXIT_FAILURE);
+ }
break;
case OPT_QUIET: