]> git.sur5r.net Git - i3/i3status/blobdiff - src/general.c
Return "no battery" instead of dying if a battery wasn’t found (Thanks Mirko)
[i3/i3status] / src / general.c
index 62d242db6fa387c5bb7f9feb81a61298a865065d..8d48f749ddbb9f6232dca6f9e4d7436a7be65b70 100644 (file)
  * 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;
 }
 
 /*