]> git.sur5r.net Git - i3/i3status/commitdiff
Handle common errors without dying
authorMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 8 Jan 2009 23:13:18 +0000 (00:13 +0100)
committerMichael Stapelberg <michael+x200@stapelberg.de>
Thu, 8 Jan 2009 23:13:18 +0000 (00:13 +0100)
config.c
wmiistatus.c

index ed5c96fa8e3238627030e204f3b40d3746b2f48e..e77ff2ef871b9887b710a9b604da1b5bc6857701 100644 (file)
--- a/config.c
+++ b/config.c
@@ -124,8 +124,6 @@ int load_configuration(const char *configfile) {
                }
                OPT("battery_path")
                {
-                       if ((stat(dest_value, &stbuf)) == -1)
-                               die("battery_path contains an invalid path");
                        battery_path = strdup(dest_value);
                }
                OPT("run_watch")
index 10b1b331e399a3b61cb3c43173b42951d551dc89..1c9360f77ea72ad9373461fec68df3c76e3679f3 100644 (file)
@@ -219,7 +219,7 @@ static char *get_battery_info() {
        charging_status_t status = CS_DISCHARGING;
 
        if ((fd = open(battery_path, O_RDONLY)) == -1)
-               die("Could not open %s", battery_path);
+               return "No battery found";
 
        memset(part, 0, sizeof(part));
        (void)read(fd, buf, sizeof(buf));
@@ -368,7 +368,7 @@ static char *get_eth_info() {
                (void)strcpy(ifr.ifr_name, eth_interface);
                if ((err = ioctl(fd, SIOCETHTOOL, &ifr)) == 0)
                        ethspeed = (ecmd.speed == 65535 ? 0 : ecmd.speed);
-               else write_error_to_statusbar("Could not get interface speed. Insufficient privileges?");
+               else get_ethspeed = false;
 
                (void)close(fd);
        }