diff options
author | Connor Lane Smith <cls@lubutu.com> | 2011-08-25 22:24:06 +0100 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2011-08-25 23:27:10 +0200 |
commit | cc1457c4f0f4cccb8bec326dd0bb13082ac806e6 (patch) | |
tree | c6489bc574d7624fb3d48487293e842f4261bfb8 /src/print_load.c | |
parent | 67ad80f0050fba9c1a57a70d1a277925805ed560 (diff) |
make modules more resilient to failure
Diffstat (limited to 'src/print_load.c')
-rw-r--r-- | src/print_load.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/print_load.c b/src/print_load.c index 9fe1964..d47ecea 100644 --- a/src/print_load.c +++ b/src/print_load.c @@ -1,6 +1,5 @@ // vim:ts=8:expandtab #include "i3status.h" -#include <err.h> #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -12,7 +11,7 @@ void print_load(const char *format) { const char *walk; if (getloadavg(loadavg, 3) == -1) - errx(-1, "getloadavg() failed\n"); + goto error; for (walk = format; *walk != '\0'; walk++) { if (*walk != '%') { @@ -35,5 +34,8 @@ void print_load(const char *format) { walk += strlen("15min"); } } + return; +error: #endif + (void)fputs("Cannot read load\n", stderr); } |