All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yu Zhiguo <yuzg@cn.fujitsu.com>
To: Keir Fraser <keir.fraser@eu.citrix.com>
Cc: xen-devel@lists.xensource.com
Subject: [PATCH] tools/xenconsole: fix Segmentation fault
Date: Mon, 08 Feb 2010 14:47:48 +0800	[thread overview]
Message-ID: <4B6FB394.9040803@cn.fujitsu.com> (raw)

Segmentation fault occurs if DOMID isn't specified.
Some check be added to output error message in this situation.

Signed-off-by: Yu Zhiguo <yuzg@cn.fujitsu.com>

diff -r 7b751b0e6f1b -r 22dfbd21b44e tools/console/client/main.c
--- a/tools/console/client/main.c	Thu Feb 04 19:40:19 2010 +0000
+++ b/tools/console/client/main.c	Mon Feb 08 11:31:06 2010 +0800
@@ -287,7 +287,13 @@
 			exit(EINVAL);
 		}
 	}
-	
+
+	if (optind >= argc) {
+		fprintf(stderr, "DOMID should be specified\n");
+		fprintf(stderr, "Try `%s --help' for more information.\n",
+			argv[0]);
+		exit(EINVAL);
+	}
 	domid = strtol(argv[optind], &end, 10);
 	if (end && *end) {
 		fprintf(stderr, "Invalid DOMID `%s'\n", argv[optind]);

                 reply	other threads:[~2010-02-08  6:47 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=4B6FB394.9040803@cn.fujitsu.com \
    --to=yuzg@cn.fujitsu.com \
    --cc=keir.fraser@eu.citrix.com \
    --cc=xen-devel@lists.xensource.com \
    /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 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.