replace access() calls for debug info where applicable

Signed-off-by: Florian Pritz <bluewind@xinu.at>
Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
Florian Pritz 2011-07-06 18:26:56 +02:00 committed by Dan McGee
parent 89c070b263
commit dad96ccce2
3 changed files with 4 additions and 5 deletions

View file

@ -205,7 +205,7 @@ static int can_remove_file(alpm_handle_t *handle, const alpm_file_t *file,
} }
/* If we fail write permissions due to a read-only filesystem, abort. /* If we fail write permissions due to a read-only filesystem, abort.
* Assume all other possible failures are covered somewhere else */ * Assume all other possible failures are covered somewhere else */
if(access(filepath, W_OK) == -1) { if(_alpm_access(handle, NULL, filepath, W_OK) == -1) {
if(errno != EACCES && errno != ETXTBSY && access(filepath, F_OK) == 0) { if(errno != EACCES && errno != ETXTBSY && access(filepath, F_OK) == 0) {
/* only return failure if the file ACTUALLY exists and we can't write to /* only return failure if the file ACTUALLY exists and we can't write to
* it - ignore "chmod -w" simple permission failures */ * it - ignore "chmod -w" simple permission failures */

View file

@ -225,7 +225,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
unsigned char *decoded_sigdata = NULL; unsigned char *decoded_sigdata = NULL;
FILE *file = NULL, *sigfile = NULL; FILE *file = NULL, *sigfile = NULL;
if(!path || access(path, R_OK) != 0) { if(!path || _alpm_access(handle, NULL, path, R_OK) != 0) {
RET_ERR(handle, ALPM_ERR_NOT_A_FILE, -1); RET_ERR(handle, ALPM_ERR_NOT_A_FILE, -1);
} }
@ -239,7 +239,7 @@ int _alpm_gpgme_checksig(alpm_handle_t *handle, const char *path,
CALLOC(sigpath, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1)); CALLOC(sigpath, len, sizeof(char), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
snprintf(sigpath, len, "%s.sig", path); snprintf(sigpath, len, "%s.sig", path);
if(!access(sigpath, R_OK) == 0) { if(!_alpm_access(handle, NULL, sigpath, R_OK) == 0) {
/* sigcount is 0 */ /* sigcount is 0 */
} }
} }

View file

@ -288,8 +288,7 @@ int _alpm_runscriptlet(alpm_handle_t *handle, const char *installfn,
int clean_tmpdir = 0; int clean_tmpdir = 0;
int retval = 0; int retval = 0;
if(access(installfn, R_OK)) { if(_alpm_access(handle, NULL, installfn, R_OK) != 0) {
/* not found */
_alpm_log(handle, ALPM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn); _alpm_log(handle, ALPM_LOG_DEBUG, "scriptlet '%s' not found\n", installfn);
return 0; return 0;
} }