Skip to contentSkip to conversation

master - lvmpolld: zero errno in before strtoul call

PATCH okozina 1 participant 1 message May 26, 2015

lore
Share & tools
lore

okozina

author
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=c069aff21b1450923b59e98ab709a5e667cdcda9
Commit:        c069aff21b1450923b59e98ab709a5e667cdcda9
Parent:        a72a80589689961285ec6aacff99087ddd8c378d
Author:        Ondrej Kozina <[email protected]>
AuthorDate:    Tue May 26 15:55:16 2015 +0200
Committer:     Ondrej Kozina <[email protected]>
CommitterDate: Tue May 26 16:27:03 2015 +0200

lvmpolld: zero errno in before strtoul call

Testing errno value without explicitly setting to
zero in before the strtoul call may lead to
unexpected failures.

---
 daemons/lvmpolld/lvmpolld-core.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)
daemons/lvmpolld/lvmpolld-core.c +1 -0
index 1a33625..c1d583e 100644
@@ -749,6 +749,7 @@ static int process_timeout_arg(const char *str, unsigned *max_timeouts)
 	char *endptr;
 	unsigned long l;
 
+	errno = 0;
 	l = strtoul(str, &endptr, 10);
 	if (errno || *endptr || l >= UINT_MAX)
 		return 0;