From 7d6997bb1fb76289dc65cc9aecb200735e209f60 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Sun, 29 May 2022 11:11:10 +0200 Subject: [PATCH] Fix an issue where updatedb would stop on certain CIFS filesystems. Reported by rollopack. --- updatedb.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/updatedb.cpp b/updatedb.cpp index 188d3c2..e1320b3 100644 --- a/updatedb.cpp +++ b/updatedb.cpp @@ -610,8 +610,12 @@ int scan(const string &path, int fd, dev_t parent_dev, dir_time modified, dir_ti } else { dir = fdopendir(fd); // Takes over ownership of fd. if (dir == nullptr) { - perror("fdopendir"); - exit(1); + // fdopendir() wants to fstat() the fd to verify that it's indeed + // a directory, which can seemingly fail on at least CIFS filesystems + // if the server feels like it. We treat this as if we had an error + // on opening it, ie., ignore the directory. + close(fd); + return 0; } dirent *de; -- 2.39.2