[Patch 11/12] tabled: check argument of -D better

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>

---
 server/server.c |    4 ++++
 1 file changed, 4 insertions(+)

commit b340bd6bbf9d7a82b69ad620f43799b616348a45
Author: Master <zaitcev@xxxxxxxxxxxxxxxxxx>
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@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Fedora Clound]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]

  Powered by Linux