FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > ArchLinux > ArchLinux Pacman Development

 
 
LinkBack Thread Tools
 
Old 03-09-2012, 06:44 PM
Dan McGee
 
Default Remove unnecessary path check from local database

This removes a call to _alpm_local_db_pkgpath() as well as an access()
call when reading the local database. This appears to be code from 2006
that has stuck around. We don't need it because:

1) We never use this path except to check it via access(); however, we
are already in a readdir() loop so it exists, or at least did at the
time of the call.
2) The fopen() and other calls will fail on accessing the database files
anyway, and we need to check those for errors.

Signed-off-by: Dan McGee <dan@archlinux.org>
---
lib/libalpm/be_local.c | 15 +++------------
1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/lib/libalpm/be_local.c b/lib/libalpm/be_local.c
index 51721d1..16c794e 100644
--- a/lib/libalpm/be_local.c
+++ b/lib/libalpm/be_local.c
@@ -405,7 +405,7 @@ static int local_db_populate(alpm_db_t *db)
rewinddir(dbdir);
}
if(est_count >= 2) {
- /* subtract the two extra pointers to get # of children */
+ /* subtract the '.' and '..' pointers to get # of children */
est_count -= 2;
}

@@ -526,7 +526,6 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
{
FILE *fp = NULL;
char line[1024];
- char *pkgpath;
alpm_db_t *db = info->origin_data.db;

/* bitmask logic here:
@@ -545,18 +544,10 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
return -1;
}

- _alpm_log(db->handle, ALPM_LOG_FUNCTION, "loading package data for %s : level=0x%x
",
+ _alpm_log(db->handle, ALPM_LOG_FUNCTION,
+ "loading package data for %s : level=0x%x
",
info->name, inforeq);

- pkgpath = _alpm_local_db_pkgpath(db, info, NULL);
- if(!pkgpath || access(pkgpath, F_OK)) {
- /* directory doesn't exist or can't be opened */
- _alpm_log(db->handle, ALPM_LOG_DEBUG, "cannot find '%s-%s' in db '%s'
",
- info->name, info->version, db->treename);
- goto error;
- }
- free(pkgpath);
-
/* clear out 'line', to be certain - and to make valgrind happy */
memset(line, 0, sizeof(line));

--
1.7.9.3
 

Thread Tools




All times are GMT. The time now is 06:20 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org