lscpu: check errno after strto..()

Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
Karel Zak 2021-06-21 15:00:40 +02:00
parent 9bf8088f25
commit 35d458708e
1 changed files with 3 additions and 0 deletions

View File

@ -166,7 +166,10 @@ static int address_from_efi(size_t *address)
continue;
*(addrp++) = '\0';
if (strcmp(linebuf, "SMBIOS") == 0) {
errno = 0;
*address = strtoul(addrp, NULL, 0);
if (errno)
continue;
ret = 0;
break;
}