1
0
mirror of https://github.com/Llewellynvdm/conky.git synced 2024-11-18 02:55:12 +00:00

Fix (possibly overkill) hwmon parsing bug.

This commit is contained in:
Brenden Matthews 2009-05-22 12:29:41 -06:00
parent 7f0929d03c
commit 1779ef3efd

View File

@ -1835,18 +1835,18 @@ static struct text_object *construct_text_object(const char *s,
return NULL;
}
buf1[0] = 0;
factor = 1.0;
offset = 0.0;
#define HWMON_RESET() {\
buf1[0] = 0; \
factor = 1.0; \
offset = 0.0; }
if (sscanf(arg, "%63s %63s %d %f %f", buf1, buf2, &n, &factor, &offset) == 5)
found = 1;
if (!found && (sscanf(arg, "%63s %d %f %f", buf2, &n, &factor, &offset) == 3))
found = 1;
if (!found && (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) == 3))
found = 1;
if (!found && (sscanf(arg, "%63s %d", buf2, &n) == 2))
found = 1;
if (sscanf(arg, "%63s %63s %d %f %f", buf1, buf2, &n, &factor, &offset) == 5) found = 1; else HWMON_RESET();
if (!found && (sscanf(arg, "%63s %d %f %f", buf2, &n, &factor, &offset) == 3)) found = 1; else HWMON_RESET();
if (!found && (sscanf(arg, "%63s %63s %d", buf1, buf2, &n) == 3)) found = 1; else HWMON_RESET();
if (!found && (sscanf(arg, "%63s %d", buf2, &n) == 2)) found = 1; else HWMON_RESET();
#undef HWMON_RESET
if (!found) {
ERR("hwmon failed to parse arguments");