From fd09a500d6456b4ba95fd501a5af67426e929dac Mon Sep 17 00:00:00 2001 From: Aurelien Foret Date: Mon, 28 Mar 2005 19:59:33 +0000 Subject: reworked dbpath handling to make it possible to use databases stored at different locations at the same time --- lib/libalpm/handle.c | 23 +++-------------------- 1 file changed, 3 insertions(+), 20 deletions(-) (limited to 'lib/libalpm/handle.c') 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) { -- cgit v1.2.3-70-g09d2