Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=fca7cf0ddef1b903190790249c3197e1642d9286

commit fca7cf0ddef1b903190790249c3197e1642d9286
Author: Miklos Vajna <[email protected]>
Date:   Sat Jan 3 00:07:25 2009 +0100

_pacman_db_test: fix directory detection inside the local database

It was possible to get a "database seems to be consistent" message even
with an inconsistent db because of this.

Reported-by: Marcus Habermehl <[email protected]>

diff --git a/lib/libpacman/be_files.c b/lib/libpacman/be_files.c
index 2341d03..a8d8539 100644
--- a/lib/libpacman/be_files.c
+++ b/lib/libpacman/be_files.c
@@ -70,7 +70,8 @@ pmlist_t *_pacman_db_test(pmdb_t *db)
pmlist_t *ret = NULL;

while ((ent = readdir(db->handle)) != NULL) {
-               stat(ent->d_name, &buf);
+               snprintf(path, PATH_MAX, "%s/%s", db->path, ent->d_name);
+               stat(path, &buf);
if(!strcmp(ent->d_name, ".") || !strcmp(ent->d_name, "..") || 
!S_ISDIR(buf.st_mode)) {
continue;
}
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to