if (!(pylibmount_debug_mask & PYMNT_DEBUG_INIT)) {
char *str = getenv("PYLIBMOUNT_DEBUG");
+ errno = 0;
pylibmount_debug_mask = 0;
if (str)
pylibmount_debug_mask = strtoul(str, NULL, 0);
+ if (errno)
+ pylibmount_debug_mask = 0;
pylibmount_debug_mask |= PYMNT_DEBUG_INIT;
}
for (i = 0; i < len; i++) {
memcpy(buf, &hex[i * 2], 2);
+ errno = 0;
bytes[i] = strtoul(buf, &endp, 16);
- if (endp != &buf[2]) {
+ if (errno || endp != &buf[2]) {
free(bytes);
return -EINVAL;
}
if (!s || !*s)
return s;
+ errno = 0;
*rc = -EINVAL;
*num = strtol(s, &end, 10);
if (end == NULL || s == end)
return s;
- if (*end == ' ' || *end == '\t' || *end == '\0')
+ if (errno == 0 && (*end == ' ' || *end == '\t' || *end == '\0'))
*rc = 0;
return end;
}
if (!s || !*s)
return s;
+ errno = 0;
*rc = -EINVAL;
*num = (uint64_t) strtoumax(s, &end, 10);
if (end == NULL || s == end)
return s;
- if (*end == ' ' || *end == '\t' || *end == '\0')
+ if (errno == 0 && (*end == ' ' || *end == '\t' || *end == '\0'))
*rc = 0;
return end;
}