]> granicus.if.org Git - neomutt/commitdiff
examine_directory: set directory/symlink size to zero
authorOlaf Hering <olaf@aepfle.de>
Tue, 3 Dec 2013 15:42:39 +0000 (16:42 +0100)
committerRichard Russon <rich@flatcap.org>
Sat, 13 Jan 2018 22:44:19 +0000 (22:44 +0000)
The size of a directory or symlink in the folder browser is not meaningful.
For directories it means just how many blocks were allocated to hold all
entries. It does not mean that the entries are still present in the directory.
For symlinks its the size of the target.
Set both to zero to simplify the folder browser output.

Signed-off-by: Olaf Hering <olaf@aepfle.de>
browser.c

index b932798e4c8f978bd19207e7e7915b486da9e05c..847d52d37df485159872023289ff84108d8fbf7e 100644 (file)
--- a/browser.c
+++ b/browser.c
@@ -800,7 +800,10 @@ static int examine_directory(struct Menu *menu, struct BrowserState *state,
       if (lstat(buffer, &s) == -1)
         continue;
 
-      if ((!S_ISREG(s.st_mode)) && (!S_ISDIR(s.st_mode)) && (!S_ISLNK(s.st_mode)))
+      /* No size for directories or symlinks */
+      if (S_ISDIR(s.st_mode) || S_ISLNK(s.st_mode))
+        s.st_size = 0;
+      else if (!S_ISREG(s.st_mode))
         continue;
 
       tmp = Incoming;