From cdb46ef3fa6d2bea95ae45b8b807497982b18fd5 Mon Sep 17 00:00:00 2001 From: Aaron Griffin Date: Sun, 4 Mar 2007 09:08:54 +0000 Subject: * Fixed a whole mess of extra '/' pathing issues when a different root is specified * Use db->path when appropriate * Commented out the FAKEROOT checks in libalpm. This should never ever be done. TODO test this quite a bit, as this will never cause the transactions to fail if RW operations are requested... right now it is totally up to the front end to decide when to fail * Use realpath() to canonicalize the root path when specified, so _alpm_makepath() doesn't freak out * Fixed some output/indent of MDFile and SHAFile algorithms * More efficient sprintf() usage in MDFile/SHAFile * Added real error output to _alpm_makepath --- lib/libalpm/sync.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'lib/libalpm/sync.c') diff --git a/lib/libalpm/sync.c b/lib/libalpm/sync.c index 71925482..337e350a 100644 --- a/lib/libalpm/sync.c +++ b/lib/libalpm/sync.c @@ -800,8 +800,8 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) EVENT(trans, PM_TRANS_EVT_RETRIEVE_START, current->treename, NULL); if(stat(ldir, &buf)) { /* no cache directory.... try creating it */ - _alpm_log(PM_LOG_WARNING, _("no %s cache exists. creating...\n"), ldir); - alpm_logaction(_("warning: no %s cache exists. creating..."), ldir); + _alpm_log(PM_LOG_WARNING, _("no %s cache exists, creating...\n"), ldir); + alpm_logaction(_("warning: no %s cache exists, creating..."), ldir); if(_alpm_makepath(ldir)) { /* couldn't mkdir the cache directory, so fall back to /tmp and unlink * the package afterwards. @@ -840,6 +840,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) sha1sum1 = spkg->sha1sum; if((md5sum1 == NULL) && (sha1sum1 == NULL)) { + /* TODO wtf is this? malloc'd strings for error messages? */ if((ptr = (char *)malloc(512)) == NULL) { RET_ERR(PM_ERR_MEMORY, -1); } @@ -848,7 +849,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) retval = 1; continue; } - snprintf(str, PATH_MAX, "%s/%s/%s", handle->root, handle->cachedir, pkgname); + snprintf(str, PATH_MAX, "%s%s%s", handle->root, handle->cachedir, pkgname); md5sum2 = _alpm_MDFile(str); sha1sum2 = _alpm_SHAFile(str); if(md5sum2 == NULL && sha1sum2 == NULL) { @@ -872,7 +873,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) } if(doremove) { char str[PATH_MAX]; - snprintf(str, PATH_MAX, "%s%s/%s", handle->root, handle->cachedir, pkgname); + snprintf(str, PATH_MAX, "%s%s%s", handle->root, handle->cachedir, pkgname); unlink(str); snprintf(ptr, 512, _("archive %s was corrupted (bad MD5 or SHA1 checksum)\n"), pkgname); } else { @@ -957,7 +958,7 @@ int _alpm_sync_commit(pmtrans_t *trans, pmdb_t *db_local, alpm_list_t **data) char str[PATH_MAX]; fname = alpm_pkg_get_filename(spkg); - snprintf(str, PATH_MAX, "%s%s/%s", handle->root, handle->cachedir, fname); + snprintf(str, PATH_MAX, "%s%s%s", handle->root, handle->cachedir, fname); if(_alpm_trans_addtarget(tr, str) == -1) { goto error; } -- cgit v1.2.3