* [Patch 11/12] tabled: check argument of -D better
@ 2010-04-18 4:43 Pete Zaitcev
0 siblings, 0 replies; only message in thread
From: Pete Zaitcev @ 2010-04-18 4:43 UTC (permalink / raw)
To: Jeff Garzik; +Cc: Project Hail List
The atoi() really does not cut it, as I discovered when I supplied
-D -E to tabled. Other arguments may benefit from such checking too,
but -D is unique in that nothing gets logged in case of this mistake.
So let's just add it here for now; others will at least report something.
Signed-off-by: Pete Zaitcev <zaitcev@redhat.com>
---
server/server.c | 4 ++++
1 file changed, 4 insertions(+)
commit b340bd6bbf9d7a82b69ad620f43799b616348a45
Author: Master <zaitcev@lembas.zaitcev.lan>
Date: Sat Apr 17 20:40:12 2010 -0600
Deconfuse -D -E.
diff --git a/server/server.c b/server/server.c
index e1b0dbe..a28965c 100644
--- a/server/server.c
+++ b/server/server.c
@@ -184,6 +184,10 @@ static error_t parse_opt (int key, char *arg, struct argp_state *state)
tabled_srv.config = arg;
break;
case 'D':
+ if (arg[0] == '-') {
+ fprintf(stderr, "Option -D requires an argument\n");
+ argp_usage(state);
+ }
v = atoi(arg);
if (v < 0 || v > 2) {
fprintf(stderr, "invalid debug level: '%s'\n", arg);
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2010-04-18 4:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-04-18 4:43 [Patch 11/12] tabled: check argument of -D better Pete Zaitcev
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.