if (prefix && strncasecmp(prefix, "part", 4) == 0) {
char *end = NULL;
+ errno = 0;
partno = strtol(prefix + 4, &end, 10);
- if (prefix == end || (end && *end))
+ if (errno || prefix == end || (end && *end))
partno = 0;
else
rc = 0; /* success */
if (rc || len == 0 || off == NULL)
return 0;
+ errno = 0;
magoff = strtoumax(off, NULL, 10);
+ if (errno)
+ return 0;
+
offset = magoff + pr->off;
fd = blkid_probe_get_fd(pr);
if (fd < 0)
DBG(READ, ul_debug("tag: %s=\"%s\"", name, value));
+ errno = 0;
+
/* Some tags are stored directly in the device struct */
- if (!strcmp(name, "DEVNO"))
+ if (!strcmp(name, "DEVNO")) {
dev->bid_devno = strtoull(value, NULL, 0);
- else if (!strcmp(name, "PRI"))
+ if (errno)
+ return -errno;
+ } else if (!strcmp(name, "PRI")) {
dev->bid_pri = strtol(value, NULL, 0);
- else if (!strcmp(name, "TIME")) {
+ if (errno)
+ return -errno;
+ } else if (!strcmp(name, "TIME")) {
char *end = NULL;
+
dev->bid_time = strtoull(value, &end, 0);
- if (end && *end == '.')
+ if (errno == 0 && end && *end == '.')
dev->bid_utime = strtoull(end + 1, NULL, 0);
+ if (errno)
+ return -errno;
} else
ret = blkid_set_tag(dev, name, value, strlen(value));