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 02-07-2012, 04:54 PM
Florian Pritz
 
Default use _alpm_access in a few more places for increased debugging info

pacman -u <pkg> returns a bogus "could not find or read package" if the
file is on a fuse file system that doesn't allow root access. Debug
output isn't very helpful here either so we should log why the access
check failed.

The other 2 checks already log something when failing so logging a more
specific error won't hurt either.

Signed-off-by: Florian Pritz <bluewind@xinu.at>
---
lib/libalpm/be_package.c | 2 +-
lib/libalpm/be_sync.c | 2 +-
lib/libalpm/util.c | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/lib/libalpm/be_package.c b/lib/libalpm/be_package.c
index 3188a2f..4b43f21 100644
--- a/lib/libalpm/be_package.c
+++ b/lib/libalpm/be_package.c
@@ -316,7 +316,7 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
}

/* attempt to access the package file, ensure it exists */
- if(access(pkgfile, R_OK) != 0) {
+ if(_alpm_access(handle, NULL, pkgfile, R_OK) != 0) {
RET_ERR(handle, ALPM_ERR_PKG_NOT_FOUND, -1);
}

diff --git a/lib/libalpm/be_sync.c b/lib/libalpm/be_sync.c
index c4673b1..f162199 100644
--- a/lib/libalpm/be_sync.c
+++ b/lib/libalpm/be_sync.c
@@ -86,7 +86,7 @@ static int sync_db_validate(alpm_db_t *db)
}

/* we can skip any validation if the database doesn't exist */
- if(access(dbpath, R_OK) != 0 && errno == ENOENT) {
+ if(_alpm_access(db->handle, NULL, dbpath, R_OK) != 0 && errno == ENOENT) {
db->status &= ~DB_STATUS_EXISTS;
db->status |= DB_STATUS_MISSING;
_alpm_log(db->handle, ALPM_LOG_WARNING,
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 24bf1fc..1128589 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -686,7 +686,7 @@ const char *_alpm_filecache_setup(alpm_handle_t *handle)
} else if(!S_ISDIR(buf.st_mode)) {
_alpm_log(handle, ALPM_LOG_DEBUG,
"skipping cachedir, not a directory: %s
", cachedir);
- } else if(access(cachedir, W_OK) != 0) {
+ } else if(_alpm_access(handle, NULL, cachedir, W_OK) != 0) {
_alpm_log(handle, ALPM_LOG_DEBUG,
"skipping cachedir, not writable: %s
", cachedir);
} else if(!(buf.st_mode & (S_IWUSR | S_IWGRP | S_IWOTH))) {
--
1.7.9
 

Thread Tools




All times are GMT. The time now is 07:01 AM.

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