summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLee Duncan <lduncan@suse.com>2017-07-27 08:58:50 -0700
committerLee Duncan <lduncan@suse.com>2017-07-27 08:58:50 -0700
commit07fa8a7a4418d3a557cc02b204d4c0ced37911ad (patch)
tree61231a7e7b360c99f54e526ce5e81ef3c50c2fe9
parent300740eaedc257879b6f379613d9f7b3a523e908 (diff)
downloadopen-iscsi-07fa8a7a4418d3a557cc02b204d4c0ced37911ad.tar.gz
Clear errno before calling strtoull.
There are two places that iscsiadm calls strotull then checks errno for failure, but errno can be left dirty from previous library calls, such as ssl initialization no non-MIPs systems. See SUSE issue: https://bugzilla.suse.com/show_bug.cgi?id=1029364
-rw-r--r--usr/iscsiadm.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/usr/iscsiadm.c b/usr/iscsiadm.c
index 6c27f3e..b30518a 100644
--- a/usr/iscsiadm.c
+++ b/usr/iscsiadm.c
@@ -3088,6 +3088,7 @@ static uint64_t parse_host_info(char *optarg, int *rc)
*rc = ISCSI_ERR_INVAL;
}
} else {
+ errno = 0; // ensure errors from strtoull are real
host_no = strtoull(optarg, NULL, 10);
if (errno || (host_no > MAX_HOST_NO)) {
if (host_no > MAX_HOST_NO)
@@ -3416,6 +3417,7 @@ main(int argc, char **argv)
ISCSI_VERSION_STR);
return 0;
case 'x':
+ errno = 0; // ensure errors from strtoull are real
index = strtoull(optarg, NULL, 10);
if (errno) {
log_error("Invalid index %s. %s.",