From 7a7af4649b47543e32105dee4ef7045d279a4dd9 Mon Sep 17 00:00:00 2001 From: "Steinar H. Gunderson" Date: Tue, 10 Nov 2020 00:19:58 +0100 Subject: [PATCH] When reading mlocate.db, properly skip the configuration block. This could cause some entries to be skipped until we regained sync, especially in the root directory. --- plocate-build.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/plocate-build.cpp b/plocate-build.cpp index 62be45d..132a3ff 100644 --- a/plocate-build.cpp +++ b/plocate-build.cpp @@ -4,6 +4,7 @@ #include #include +#include #include #include #include @@ -420,6 +421,12 @@ void read_mlocate(FILE *fp, DatabaseReceiver *receiver) // TODO: Care about the base path. string path = read_cstr(fp); + + if (fseek(fp, ntohl(hdr.conf_size), SEEK_CUR) != 0) { + perror("skip conf block"); + exit(1); + } + while (!feof(fp)) { handle_directory(fp, receiver); } -- 2.39.2