]> git.sur5r.net Git - i3/i3status/blobdiff - src/print_disk_info.c
Print empty string for not mounted disks. (#148)
[i3/i3status] / src / print_disk_info.c
index edc69ace299639863c26515aee67d30f911abd29..624a8e2f2c2431d3074c36c0957909a8ca9dcc07 100644 (file)
@@ -130,13 +130,15 @@ void print_disk_info(yajl_gen json_gen, char *buffer, const char *path, const ch
 #else
     struct statvfs buf;
 
+    if (format_not_mounted == NULL) {
+        format_not_mounted = "";
+    }
+
     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. */
-        if (format_not_mounted != NULL) {
-            format = format_not_mounted;
-        }
-    } else if (format_not_mounted != NULL) {
+        format = format_not_mounted;
+    } else {
         FILE *mntentfile = setmntent("/etc/mtab", "r");
         struct mntent *m;
         bool found = false;