]> Untitled Git - dockapps/dockbatmon.git/commitdiff
Improve error handling
authorHugo Villeneuve <hugo@hugovil.com>
Sat, 28 Feb 2015 22:36:21 +0000 (17:36 -0500)
committerHugo Villeneuve <hugo@hugovil.com>
Sun, 2 Jan 2022 22:43:17 +0000 (17:43 -0500)
src/batmon.c

index c8781e1d4d5923bbf93da216383ddf57f0ea4899..d4aa03a0cf712745e3e5f20f92ce3307e38bc322 100644 (file)
@@ -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);