[Bug 1547060] [NEW] cant use -d switch
stsp
stsp at list.ru
Thu Feb 18 15:20:26 UTC 2016
Public bug reported:
tgt-1:1.0.62-1ubuntu2
# ./tgtd -d 1
-d argument value '1' invalid
Try `tgtd --help' for more information.
The following change should fix the problem:
--- util.h.old 2015-12-02 03:27:15.000000000 +0300
+++ util.h 2016-02-18 18:04:08.749932076 +0300
@@ -148,7 +148,7 @@
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; \
Here, the errno is checked incorrectly: you can't check
errno unless the returned value allows you to. In case
of strtoull(), errno should be checked only if ULONG_MAX is
returned.
I however can't test the fix properly because when compiled
from source, the bug doesn't happen. The value of errno is
unspecified, and it just happens to be 0 when I compile from
sources.
** Affects: tgt (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Server Team, which is subscribed to tgt in Ubuntu.
https://bugs.launchpad.net/bugs/1547060
Title:
cant use -d switch
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/tgt/+bug/1547060/+subscriptions
More information about the Ubuntu-server-bugs
mailing list