From: Hugo Villeneuve Date: Sat, 28 Feb 2015 22:36:21 +0000 (-0500) Subject: Improve error handling X-Git-Url: http://gitweb.hugovil.com/?a=commitdiff_plain;h=85eab487f248a0f6a1cb4f93cf8894967c0e9ac5;p=dockapps%2Fdockbatmon.git Improve error handling --- 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);