index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Dan McGee <dan@archlinux.org> | 2011-01-24 17:48:54 -0600 |
---|---|---|
committer | Allan McRae <allan@archlinux.org> | 2011-02-04 09:55:45 +1000 |
commit | 5dae577a87795e7666f05613cf9aa7207fd17346 (patch) | |
tree | 5e898c5c7290e83bf6da41c9bfd6293a24269d56 /lib/libalpm/be_local.c | |
parent | e17b0446bd815f7b25f5bf0b838ef3d02d4eb64e (diff) |
-rw-r--r-- | lib/libalpm/be_local.c | 8 |
diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c index c7110faf..b97fca71 100644 --- a/lib/libalpm/be_local.c +++ b/lib/libalpm/be_local.c @@ -367,7 +367,8 @@ static int is_dir(const char *path, struct dirent *entry) static int local_db_populate(pmdb_t *db) { - int count = 0; + int est_count, count = 0; + struct stat buf; struct dirent *ent = NULL; const char *dbpath; DIR *dbdir; @@ -384,6 +385,11 @@ static int local_db_populate(pmdb_t *db) if(dbdir == NULL) { return(0); } + if(fstat(dirfd(dbdir), &buf) != 0) { + return(0); + } + /* subtract the two always-there pointers to get # of children */ + est_count = (int)buf.st_nlink - 2; while((ent = readdir(dbdir)) != NULL) { const char *name = ent->d_name; |