summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOndrej Kozina <okozina@redhat.com>2015-05-26 16:01:40 +0200
committerOndrej Kozina <okozina@redhat.com>2015-05-26 16:27:10 +0200
commit8af5f54824f889c438104625dbe159f6e8dedbc4 (patch)
tree372770cda53f43b24f7f6d5264debcdfba5618b4
parentc069aff21b1450923b59e98ab709a5e667cdcda9 (diff)
downloadlvm2-8af5f54824f889c438104625dbe159f6e8dedbc4.tar.gz
dmsetup: zero errno in before strtoul call
Testing errno value without explicitly setting to zero in before the strtoul call may lead to unexpected failures.
-rw-r--r--tools/dmsetup.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 4202dbbb4..f200e949f 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -914,6 +914,7 @@ static uint32_t _get_cookie_value(const char *str_value)
unsigned long int value;
char *p;
+ errno = 0;
if (!(value = strtoul(str_value, &p, 0)) ||
*p ||
(value == ULONG_MAX && errno == ERANGE) ||