fix errno use after strtoull
PATCH 1/1 fix errno use after strtoull
As described in this bug:
https://bugs.launchpad.net/ubuntu/+source/tgt/+bug/1547060
Patch comes from an outstanding pull request from Stas Sergeev here:
https://github.com/fujita/tgt/pull/18/
I've tested this patch and verified that it resolves the issue with use of parameters with numbers in our Ubuntu package. I've also filed a similar bug in Debian here:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=822160
Please consider accepting the patch.
Signature · 22 lines
Ryan Harper Canonical, Ltd. == From 3f3991ee3345f9728928711f6be7a0020568faf6 Mon Sep 17 00:00:00 2001 From: Stas Sergeev <[email protected]> Date: Thu, 18 Feb 2016 18:35:23 +0300 Subject: [PATCH] fix errno check errno can only be checked if the return value indicates an error. The result of this bug is the following: ./tgtd -d 1 -d argument value '1' invalid Try `tgtd --help' for more information. As can be seen, it rejects the valid parameter because errno just happens to be non-zero. --- usr/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
usr/util.h +1 -1
@@ -148,7 +148,7 @@ struct signalfd_siginfo {unsigned long long ull_val; \ ull_val =strtoull (str, &ptr,0 ); \ val = (typeof (val )) ull_val; \ -if (errno || ptr == str) \ +if (ull_val ==ULONG_MAX || ptr == str) \ ret =EINVAL ; \else if (val != ull_val) \ ret =ERANGE ; \
FUJITA Tomonori
AppliedQuoted 12 lines · On Thu, 21 Apr 2016 11:22:40 -0500 Ryan Harper <[email protected]>…
From
3f3991ee3345f9728928711f6be7a0020568faf6Mon Sep 17 00:00:00 2001
From: Stas Sergeev <[email protected]>
Date: Thu, 18 Feb 2016 18:35:23 +0300
Subject: [PATCH] fix errno checkerrno can only be checked if the return value indicates an error. The result of this bug is the following:
./tgtd -d 1
-d argument value '1' invalid
Try `tgtd --help' for more information.
Quoted 5 lines
As can be seen, it rejects the valid parameter because errno just happens to be non-zero.
--- usr/util.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Applied, thanks!