From 3145ab7a87d8e199d1c9eb52efe92354673d3a82 Mon Sep 17 00:00:00 2001 From: Archana Shinde Date: Thu, 26 Jan 2017 00:15:22 +0000 Subject: [PATCH] Set errno to zero for checking it after strtol(). It is necessary to clear the errno out first before calling strtol. This was causing issues when uid/gid was passed as 0. Signed-off-by: Archana Shinde --- src/util.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/util.c b/src/util.c index 4fe80e31..522cc706 100644 --- a/src/util.c +++ b/src/util.c @@ -126,6 +126,7 @@ int hyper_find_sd(char *addr, char **dev) static unsigned long id_or_max(const char *name) { char *ptr; + errno = 0; long id = strtol(name, &ptr, 10); if (name == ptr || id < 0 || (errno != 0 && id == 0) || *ptr != '\0') return ~0UL;