summaryrefslogtreecommitdiff
path: root/src/general.c
diff options
context:
space:
mode:
authorMichael Stapelberg <michael@stapelberg.de>2009-07-25 21:32:38 +0200
committerMichael Stapelberg <michael@stapelberg.de>2009-07-25 21:32:38 +0200
commitf8be2d1b81454be9f3205f3c908ea11e23f9c1e9 (patch)
tree5332d8cd5bd0c7cd9d572e6f8fe51f39bd988b30 /src/general.c
parent94911d4cc3741df95fef45e0cceed1ebc311404b (diff)
Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko)
Diffstat (limited to 'src/general.c')
-rw-r--r--src/general.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/general.c b/src/general.c
index 62d242d..8d48f74 100644
--- a/src/general.c
+++ b/src/general.c
@@ -13,14 +13,16 @@
* Reads size bytes into the destination buffer from filename.
*
*/
-void slurp(char *filename, char *destination, int size) {
+bool slurp(char *filename, char *destination, int size) {
int fd;
if ((fd = open(filename, O_RDONLY)) == -1)
- die("Could not open \"%s\"\n", filename);
+ return false;
(void)read(fd, destination, size);
(void)close(fd);
+
+ return true;
}
/*