summaryrefslogtreecommitdiff
path: root/components/temperature.c
diff options
context:
space:
mode:
Diffstat (limited to 'components/temperature.c')
-rw-r--r--components/temperature.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/components/temperature.c b/components/temperature.c
index 7be5118..c61a574 100644
--- a/components/temperature.c
+++ b/components/temperature.c
@@ -53,6 +53,8 @@
#include <stdlib.h>
#include <sys/sysctl.h>
+ #define ACPI_TEMP "hw.acpi.thermal.%s.temperature"
+
const char *
temp(const char *zone)
{
@@ -61,8 +63,8 @@
size_t len;
len = sizeof(temp);
- snprintf(buf, sizeof(buf), "hw.acpi.thermal.%s.temperature", zone);
- if (sysctlbyname(buf, &temp, &len, NULL, 0) == -1
+ snprintf(buf, sizeof(buf), ACPI_TEMP, zone);
+ if (sysctlbyname(buf, &temp, &len, NULL, 0) < 0
|| !len)
return NULL;