diff options
author | Michael Stapelberg <michael@stapelberg.de> | 2009-07-25 21:32:38 +0200 |
---|---|---|
committer | Michael Stapelberg <michael@stapelberg.de> | 2009-07-25 21:32:38 +0200 |
commit | f8be2d1b81454be9f3205f3c908ea11e23f9c1e9 (patch) | |
tree | 5332d8cd5bd0c7cd9d572e6f8fe51f39bd988b30 /src/get_wireless_info.c | |
parent | 94911d4cc3741df95fef45e0cceed1ebc311404b (diff) |
Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko)
Diffstat (limited to 'src/get_wireless_info.c')
-rw-r--r-- | src/get_wireless_info.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/get_wireless_info.c b/src/get_wireless_info.c index 4d8d0b2..c257f56 100644 --- a/src/get_wireless_info.c +++ b/src/get_wireless_info.c @@ -20,7 +20,8 @@ const char *get_wireless_info() { memset(buf, 0, sizeof(buf)); memset(part, 0, sizeof(part)); - slurp("/proc/net/wireless", buf, sizeof(buf)); + if (!slurp("/proc/net/wireless", buf, sizeof(buf))) + die("Could not open \"/proc/net/wireless\"\n"); interfaces = skip_character(buf, '\n', 1) + 1; while ((interfaces = skip_character(interfaces, '\n', 1)+1) < buf+strlen(buf)) { |