Ticket 182

git-svn-id: https://ssl.bulix.org/svn/lcd4linux/trunk@1079 3ae390bd-cb1e-0410-b409-cd5a39f66f1f
This commit is contained in:
volker
2010-01-15 21:44:04 +00:00
parent ac266e1877
commit 69fecdd3d6
3 changed files with 31 additions and 21 deletions

View File

@@ -113,18 +113,18 @@ static int parse_cpuinfo(char *oid)
size_t val_len;
if (sysctlbyname(oid, NULL, &val_len, NULL, 0) != 0) {
error("Error %d by sysctl(%s): %s", errno, oid, strerror(errno));
return -1;
error("Error %d by sysctl(%s): %s", errno, oid, strerror(errno));
return -1;
}
if (val_len > sizeof(val_ret)) {
error("Error: Result of sysctl(%s) too big (%zd > %zd)!", oid, val_len, sizeof(val_ret));
return -1;
error("Error: Result of sysctl(%s) too big (%zd > %zd)!", oid, val_len, sizeof(val_ret));
return -1;
}
sysctlbyname(oid, &val_ret, &val_len, NULL, 0);
if (val_len == sizeof(int)) {
/* we got an integer instead of a string */
val = (int*)val_ret;
snprintf(val_ret, sizeof(val_ret), "%d", *val);
/* we got an integer instead of a string */
val = (int *) val_ret;
snprintf(val_ret, sizeof(val_ret), "%d", *val);
}
hash_put(&CPUinfo, oid, val_ret);
#endif