On Wed, 20 Jan 2021 at 04:37, Pascal Ernster <[email protected]> wrote: > > > Signed-off-by: Pascal Ernster <[email protected]> > --- > src/pacman/sync.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/src/pacman/sync.c b/src/pacman/sync.c > index a05af5da..9ec4c92e 100644 > --- a/src/pacman/sync.c > +++ b/src/pacman/sync.c > @@ -105,7 +105,7 @@ static int sync_cleandb(const char *dbpath) > dbname = strndup(dname, len - 7); > } else if(len > 6 && strcmp(dname + len - 6, ".files") == 0) { > dbname = strndup(dname, len - 6); > - } else if(len > 6 && strcmp(dname + len - 6, ".files.sig") == > 0) { > + } else if(len > 10 && strcmp(dname + len - 10, ".files.sig") > == 0) { > dbname = strndup(dname, len - 10); Fwiw one could replace the hard-coded numbers with strlen() which the compiler will turn into compile time constants. To make the code a little easier to read, a trivial static inline helper could be introduced.
I might follow-up at some point unless someone beats me to it :-P -Emil
