summaryrefslogtreecommitdiff
path: root/lib/libalpm/handle.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2005-03-28 19:59:33 +0000
committerAurelien Foret <aurelien@archlinux.org>2005-03-28 19:59:33 +0000
commitfd09a500d6456b4ba95fd501a5af67426e929dac (patch)
tree92ab412b3d77b2c3752321f1033e4f8d09fd7ee9 /lib/libalpm/handle.c
parent61231c9ba86456e424bc45354feeb91cc52119f8 (diff)
downloadpacman-fd09a500d6456b4ba95fd501a5af67426e929dac.tar.xz
reworked dbpath handling to make it possible to use databases stored at different locations at the same time
Diffstat (limited to 'lib/libalpm/handle.c')
-rw-r--r--lib/libalpm/handle.c23
1 files changed, 3 insertions, 20 deletions
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 8034f6c9..1705ae40 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -109,33 +109,16 @@ int handle_free(pmhandle_t *handle)
int handle_set_option(pmhandle_t *handle, unsigned char val, unsigned long data)
{
- PMList *lp;
- char str[PATH_MAX];
-
/* Sanity checks */
ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1));
switch(val) {
case PM_OPT_DBPATH:
- if(handle->db_local) {
- RET_ERR(PM_ERR_DB_NOT_NULL, -1);
- }
- for(lp = handle->dbs_sync; lp; lp = lp->next) {
- if(lp->data) {
- RET_ERR(PM_ERR_DB_NOT_NULL, -1);
- }
+ if(handle->dbpath) {
+ FREE(handle->dbpath);
}
-
- if(handle->trans && handle->trans->state != STATE_IDLE) {
- RET_ERR(PM_ERR_TRANS_INITIALIZED, -1);
- }
-
- strncpy(str, ((char *)data) ? (char *)data : PM_DBPATH, PATH_MAX);
- handle->dbpath = strdup(str);
+ handle->dbpath = strdup((data && strlen((char *)data) != 0) ? (char *)data : PM_DBPATH);
_alpm_log(PM_LOG_FLOW2, "PM_OPT_DBPATH set to '%s'", handle->dbpath);
- /* ORE
- We should browse all databases to update db->path fields with the new
- DBPATH value */
break;
case PM_OPT_LOGFILE:
if((char *)data == NULL || handle->uid != 0) {