]> git.sesse.net Git - plocate/commitdiff
Fix an issue where updatedb would stop on certain CIFS filesystems.
authorSteinar H. Gunderson <steinar+git@gunderson.no>
Sun, 29 May 2022 09:11:10 +0000 (11:11 +0200)
committerSteinar H. Gunderson <steinar+git@gunderson.no>
Sun, 29 May 2022 09:11:10 +0000 (11:11 +0200)
Reported by rollopack.

updatedb.cpp

index 188d3c2113f08c7ecd2de6045d9f6694782e6625..e1320b3e1ef58affd7dda61f7486921589754f8f 100644 (file)
@@ -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) {
        } 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;
                }
 
                dirent *de;