From 85eab487f248a0f6a1cb4f93cf8894967c0e9ac5 Mon Sep 17 00:00:00 2001 From: Hugo Villeneuve Date: Sat, 28 Feb 2015 17:36:21 -0500 Subject: [PATCH] Improve error handling --- src/batmon.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/batmon.c b/src/batmon.c index c8781e1..d4aa03a 100644 --- a/src/batmon.c +++ b/src/batmon.c @@ -76,6 +76,9 @@ static void read_ac_status(void) if (ac_file == NULL) { perror(ac_file_path); + fprintf(stderr, + "Unable to find power supply AC online status.\n"); + exit(EXIT_FAILURE); } else { while (!feof(ac_file)) { memset(ac_file_line, 0, 40); @@ -106,6 +109,9 @@ static void read_battery_status(void) if (batt_file == NULL) { perror(batt_file_path); + fprintf(stderr, + "Unable to determine battery capacity.\n"); + exit(EXIT_FAILURE); } else { while (!feof(batt_file)) { memset(batt_file_line, 0, 40); -- 2.20.1