* [patch iproute2] lib/utils.c: should return correct error message
@ 2013-11-14 7:00 Hangbin Liu
2013-11-14 17:42 ` Stephen Hemminger
0 siblings, 1 reply; 2+ messages in thread
From: Hangbin Liu @ 2013-11-14 7:00 UTC (permalink / raw)
To: network dev; +Cc: Hangbin Liu
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch iproute2] lib/utils.c: should return correct error message
2013-11-14 7:00 [patch iproute2] lib/utils.c: should return correct error message Hangbin Liu
@ 2013-11-14 17:42 ` Stephen Hemminger
0 siblings, 0 replies; 2+ messages in thread
From: Stephen Hemminger @ 2013-11-14 17:42 UTC (permalink / raw)
To: Hangbin Liu; +Cc: network dev
On Thu, 14 Nov 2013 15:00:24 +0800
Hangbin Liu <liuhangbin@gmail.com> wrote:
> 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;
Thanks for the patch but
I don't see a lot of improvement with the new error message
to warrant making the change.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2013-11-14 17:53 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-11-14 7:00 [patch iproute2] lib/utils.c: should return correct error message Hangbin Liu
2013-11-14 17:42 ` Stephen Hemminger
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).