From: Jan Synacek <jsynacek@redhat.com>
To: yoshfuji@linux-ipv6.org
Cc: netdev@vger.kernel.org, jsynacek@redhat.com
Subject: Re: [PATCH 2/2 fixed] ping6: Fix -F switch.
Date: Mon, 10 Dec 2012 11:12:54 +0100 [thread overview]
Message-ID: <50C5B5A6.7020201@redhat.com> (raw)
In-Reply-To: <50C5B24F.5030900@redhat.com>
Even when the flowlabel is set correctly, ping6 exits with a warning. The errno
should be checked only if the previous call returned a negative value. In this
case, there is no need to check errno, checking for a negative value is enough.
Signed-off-by: Jan Synacek <jsynacek@redhat.com>
---
ping6.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/ping6.c b/ping6.c
index 358a035..94a24b0 100644
--- a/ping6.c
+++ b/ping6.c
@@ -724,8 +724,9 @@ int main(int argc, char *argv[])
while ((ch = getopt(argc, argv, COMMON_OPTSTR "F:N:")) != EOF) {
switch(ch) {
case 'F':
- flowlabel = hextoui(optarg);
- if (errno || (flowlabel & ~IPV6_FLOWINFO_FLOWLABEL)) {
+ err = hextoui(optarg);
+ flowlabel = (__u32)err;
+ if (err < 0 || (flowlabel & ~IPV6_FLOWINFO_FLOWLABEL)) {
fprintf(stderr, "ping: Invalid flowinfo %s\n", optarg);
exit(2);
}
--
1.8.0.1
next prev parent reply other threads:[~2012-12-10 10:12 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-12-07 8:25 [PATCH 0/2] iputils: minor ninfod and ping6 fixes Jan Synacek
2012-12-07 8:25 ` [PATCH 1/2] ninfod: Fix more unused variables Jan Synacek
2012-12-07 8:25 ` [PATCH 2/2] ping6: Fix -F switch Jan Synacek
2012-12-10 9:58 ` Jan Synacek
2012-12-10 10:12 ` Jan Synacek [this message]
2012-12-19 21:05 ` [PATCH 0/2] iputils: minor ninfod and ping6 fixes YOSHIFUJI Hideaki
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=50C5B5A6.7020201@redhat.com \
--to=jsynacek@redhat.com \
--cc=netdev@vger.kernel.org \
--cc=yoshfuji@linux-ipv6.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).