Subject: Re: [PATCH 2/2 fixed] ping6: Fix -F switch.

From: Jan Synacek <[email-masked]>
Date: Mon, 10 Dec 2012 11:12:54 +0100

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 <[email-masked]>
---
 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