From f8be2d1b81454be9f3205f3c908ea11e23f9c1e9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 25 Jul 2009 21:32:38 +0200 Subject: Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/get_cpu_temperature.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/get_cpu_temperature.c') diff --git a/src/get_cpu_temperature.c b/src/get_cpu_temperature.c index 09fbd25..ca6b9df 100644 --- a/src/get_cpu_temperature.c +++ b/src/get_cpu_temperature.c @@ -24,7 +24,8 @@ const char *get_cpu_temperature_info() { #if defined(LINUX) long int temp; - slurp(thermal_zone, buf, sizeof(buf)); + if (!slurp(thermal_zone, buf, sizeof(buf))) + die("Could not open \"%s\"\n", thermal_zone); temp = strtol(buf, NULL, 10); if (temp == LONG_MIN || temp == LONG_MAX || temp <= 0) (void)snprintf(buf, sizeof(buf), "T: ? C"); -- cgit v1.2.3