From 8ee9459465e8a679669736c401149f4b79b201c8 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 29 Feb 2004 10:25:54 +0000 Subject: [PATCH] Correctly handle 2.6 subclients. Original patch by Andrey Borzenkov, much reworked. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2327 7894878c-1315-0410-8ee3-d5d059ff63e0 --- lib/proc.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/lib/proc.c b/lib/proc.c index 8ea3c8f2..d8072571 100644 --- a/lib/proc.c +++ b/lib/proc.c @@ -125,9 +125,16 @@ int sensors_read_proc_chips(void) strcat(n, "/name"); if ((f = fopen(n, "r")) != NULL) { - char x[120]; - fscanf(f, "%[a-zA-z0-9_]", x); + char x[81]; + int len = 0; + if (!fscanf(f, "%80[a-zA-z0-9_ ]%n", x, &len)) { + fclose(f); + continue; + } fclose(f); + if (len >= 10 && !strcmp(x+len-10, " subclient")) + continue; + /* HACK */ strcat(x, "-*"); if ((res = sensors_parse_chip_name(x, &entry.name))) { char em[NAME_MAX + 20];