netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Hangbin Liu <liuhangbin@gmail.com>
To: network dev <netdev@vger.kernel.org>
Cc: Hangbin Liu <liuhangbin@gmail.com>
Subject: [patch iproute2] lib/utils.c: should return correct error message
Date: Thu, 14 Nov 2013 15:00:24 +0800	[thread overview]
Message-ID: <1384412424-746-1-git-send-email-liuhangbin@gmail.com> (raw)

Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
---
 lib/utils.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/utils.c b/lib/utils.c
index 4e9c719..59221b2 100644
--- a/lib/utils.c
+++ b/lib/utils.c
@@ -487,7 +487,11 @@ int get_addr(inet_prefix *dst, const char *arg, int family)
 		exit(1);
 	}
 	if (get_addr_1(dst, arg, family)) {
-		fprintf(stderr, "Error: an inet address is expected rather than \"%s\".\n", arg);
+		// FIXME: Don't know how to handle AF_UNSPEC and AF_DECnet
+		if (family == AF_INET6)
+			fprintf(stderr, "Error: an inet6 address is expected rather than \"%s\".\n", arg);
+		else
+			fprintf(stderr, "Error: an inet address is expected rather than \"%s\".\n", arg);
 		exit(1);
 	}
 	return 0;
@@ -500,7 +504,11 @@ int get_prefix(inet_prefix *dst, char *arg, int family)
 		exit(1);
 	}
 	if (get_prefix_1(dst, arg, family)) {
-		fprintf(stderr, "Error: an inet prefix is expected rather than \"%s\".\n", arg);
+		// FIXME: Don't know how to handle AF_DECnet
+		if (family == AF_INET6)
+			fprintf(stderr, "Error: an inet6 prefix is expected rather than \"%s\".\n", arg);
+		else
+			fprintf(stderr, "Error: an inet prefix is expected rather than \"%s\".\n", arg);
 		exit(1);
 	}
 	return 0;
-- 
1.8.1.4

             reply	other threads:[~2013-11-14  7:01 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-11-14  7:00 Hangbin Liu [this message]
2013-11-14 17:42 ` [patch iproute2] lib/utils.c: should return correct error message Stephen Hemminger

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=1384412424-746-1-git-send-email-liuhangbin@gmail.com \
    --to=liuhangbin@gmail.com \
    --cc=netdev@vger.kernel.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;
as well as URLs for NNTP newsgroup(s).