projects
/
awesomized
/
libmemcached
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
|
github
raw
|
inline
| side by side
Fix for lp:1123153 (poor use of strtol).
[awesomized/libmemcached]
/
clients
/
memping.cc
diff --git
a/clients/memping.cc
b/clients/memping.cc
index f4fcec861a34e06d6b9701c298785c5dffd5331c..39546d4f660be95d4bf994a8c6bf731e332c802f 100644
(file)
--- a/
clients/memping.cc
+++ b/
clients/memping.cc
@@
-9,12
+9,14
@@
* Summary:
*
*/
* Summary:
*
*/
-#include "config.h"
+#include "
mem_
config.h"
-#include <
stdio.h
>
-#include <
unistd.h
>
-#include <
string.h
>
+#include <
cerrno
>
+#include <
cstdio
>
+#include <
cstring
>
#include <getopt.h>
#include <getopt.h>
+#include <unistd.h>
+
#include <libmemcached-1.0/memcached.h>
#include <libmemcachedutil-1.0/util.h>
#include "client_options.h"
#include <libmemcached-1.0/memcached.h>
#include <libmemcachedutil-1.0/util.h>
#include "client_options.h"
@@
-139,11
+141,18
@@
void options_parse(int argc, char *argv[])
break;
case OPT_EXPIRE: /* --expire */
break;
case OPT_EXPIRE: /* --expire */
- opt_expire= (time_t)strtoll(optarg, (char **)NULL, 10);
+ errno= 0;
+ opt_expire= time_t(strtoll(optarg, (char **)NULL, 10));
+ if (errno != 0)
+ {
+ std::cerr << "Incorrect value passed to --expire: `" << optarg << "`" << std::cerr;
+ exit(EXIT_FAILURE);
+ }
break;
case OPT_USERNAME:
opt_username= optarg;
break;
case OPT_USERNAME:
opt_username= optarg;
+ opt_binary= true;
break;
case OPT_PASSWD:
break;
case OPT_PASSWD: