diff --git a/src/hddtemp.c b/src/hddtemp.c index e5a47598..93b79a07 100644 --- a/src/hddtemp.c +++ b/src/hddtemp.c @@ -173,6 +173,7 @@ static int read_hdd_val(const char *line, char **dev, short *val, char *unit, } line_s = *saveptr; +again: /* read the device */ *dev = ++p; if (!(p = strchr(p, line_s[0]))) @@ -188,8 +189,13 @@ static int read_hdd_val(const char *line, char **dev, short *val, char *unit, *(p++) = '\0'; *unit = *(p++); *val = strtol(cval, &endptr, 10); - if (*endptr) - goto out_fail; + if (*endptr) { + if (!(p = strchr(p, line_s[0]))) + goto out_fail; + + p++; + goto again; + } /* preset p for next call */ p++;