[prev in list] [next in list] [prev in thread] [next in thread] 

List:       hail-devel
Subject:    [Patch 11/12] tabled: check argument of -D better
From:       Pete Zaitcev <zaitcev () redhat ! com>
Date:       2010-04-18 4:43:59
Message-ID: 20100417224359.0f83992a () redhat ! com
[Download RAW message or body]

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);
--
To unsubscribe from this list: send the line "unsubscribe hail-devel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic