index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aaron Griffin <aaron@archlinux.org> | 2006-12-01 09:32:29 +0000 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2006-12-01 09:32:29 +0000 |
commit | 08dca1593f82dfa4b5f1199b5b1f4d7099719be9 (patch) | |
tree | b1b383f93524ebfcb5bfcc98924668f29dc88ba3 /lib/libalpm/alpm.c | |
parent | 6c68723905ba1d8cee83e4af88b0ac8ee9a408aa (diff) |
-rw-r--r-- | lib/libalpm/alpm.c | 9 |
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c index 1bda976c..a7fb0a99 100644 --- a/lib/libalpm/alpm.c +++ b/lib/libalpm/alpm.c @@ -261,8 +261,13 @@ int alpm_db_update(int force, pmdb_t *db) /* Sanity checks */ ASSERT(handle != NULL, RET_ERR(PM_ERR_HANDLE_NULL, -1)); ASSERT(db != NULL && db != handle->db_local, RET_ERR(PM_ERR_WRONG_ARGS, -1)); - /* Do not update a database if a transaction is on-going */ - ASSERT(handle->trans == NULL, RET_ERR(PM_ERR_TRANS_NOT_NULL, -1)); + /* Verify we are in a transaction. This is done _mainly_ because we need a DB + * lock - if we update without a db lock, we may kludge some other pacman + * process that _has_ a lock. + */ + ASSERT(handle->trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1)); + ASSERT(handle->trans->state == STATE_INITIALIZED, RET_ERR(PM_ERR_TRANS_NOT_INITIALIZED, -1)); + ASSERT(handle->trans->type == PM_TRANS_TYPE_SYNC, RET_ERR(PM_ERR_TRANS_TYPE, -1)); if(!_alpm_list_is_in(db, handle->dbs_sync)) { RET_ERR(PM_ERR_DB_NOT_FOUND, -1); |