public inbox for hail-devel@vger.kernel.org
 help / color / mirror / Atom feed
From: Pete Zaitcev <zaitcev@redhat.com>
To: Jeff Garzik <jeff@garzik.org>
Cc: Project Hail List <hail-devel@vger.kernel.org>
Subject: [Patch 11/12] tabled: check argument of -D better
Date: Sat, 17 Apr 2010 22:43:59 -0600	[thread overview]
Message-ID: <20100417224359.0f83992a@redhat.com> (raw)

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);

                 reply	other threads:[~2010-04-18  4:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100417224359.0f83992a@redhat.com \
    --to=zaitcev@redhat.com \
    --cc=hail-devel@vger.kernel.org \
    --cc=jeff@garzik.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox