]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_disk_info.c
Use format_not_mounted if the directory for a disk_info block does not exist.
[i3/i3status] / src / print_disk_info.c
index 69d7b8c6187445fe36047ce0c190355b3226c15c..7fd47b9d916ded11ef2352de930ef41fe12c9ac9 100644 (file)
@@ -124,10 +124,11 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
 #else
     struct statvfs buf;
 
-    if (statvfs(path, &buf) == -1)
-        return;
-
-    if (format_not_mounted != NULL) {
+    if (statvfs(path, &buf) == -1) {
+        /* If statvfs errors, e.g., due to the path not existing,
+         * we use the format for a not mounted device. */
+        format = format_not_mounted;
+    } else if (format_not_mounted != NULL) {
         FILE *mntentfile = setmntent("/etc/mtab", "r");
         struct mntent *m;
         bool found = false;