aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorn3f4s <tiv.crb@gmail.com>2021-07-08 17:22:49 +0200
committerHarry Jeffery <harry@exec64.co.uk>2021-07-08 23:16:08 +0100
commit22cd0b38131cb07e9ca0b0b8ff326fb67b4c432d (patch)
tree27ff904c1ee51d834fa257b89431579b4371eeb1 /src
parentdeb8b5a86450153b2a8abc3418b6e66691c49896 (diff)
downloadimv-22cd0b38131cb07e9ca0b0b8ff326fb67b4c432d.tar.gz
Don't stop listing files in dir when stat fail
Check errno when stat fail during traversal of a directory: doesn't stop traversing for all stat errors
Diffstat (limited to 'src')
-rw-r--r--src/navigator.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/navigator.c b/src/navigator.c
index d62ea52..e93d682 100644
--- a/src/navigator.c
+++ b/src/navigator.c
@@ -9,6 +9,7 @@
#include <string.h>
#include <sys/stat.h>
#include <time.h>
+#include <errno.h>
#include "list.h"
@@ -87,8 +88,12 @@ int imv_navigator_add(struct imv_navigator *nav, const char *path,
snprintf(path_buf, sizeof path_buf, "%s/%s", path, dir->d_name);
struct stat new_path_info;
if (stat(path_buf, &new_path_info)) {
- result = 1;
- break;
+ switch (errno) {
+ case ELOOP:
+ case ENOTDIR:
+ case ENOENT: continue;
+ default: result = 1; break;
+ }
}
int is_dir = S_ISDIR(new_path_info.st_mode);
if (is_dir && recursive) {