From f8be2d1b81454be9f3205f3c908ea11e23f9c1e9 Mon Sep 17 00:00:00 2001 From: Michael Stapelberg Date: Sat, 25 Jul 2009 21:32:38 +0200 Subject: Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/general.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/general.c') 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; } /* -- cgit v1.2.3