Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.

Commit 3145ab7

Browse files
committed
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 <archana.m.shinde@intel.com>
1 parent bd9aac7 commit 3145ab7

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/util.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ int hyper_find_sd(char *addr, char **dev)
126126
static unsigned long id_or_max(const char *name)
127127
{
128128
char *ptr;
129+
errno = 0;
129130
long id = strtol(name, &ptr, 10);
130131
if (name == ptr || id < 0 || (errno != 0 && id == 0) || *ptr != '\0')
131132
return ~0UL;

0 commit comments

Comments
 (0)