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

Commit 26c6654

Browse files
authored
Merge pull request #258 from amshinde/clear-errno
Set errno to zero for checking it after strtol().
2 parents d668832 + 3145ab7 commit 26c6654

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)