From 6946d7d1b77a550c3f4de48e4cc6ad1094ac6b10 Mon Sep 17 00:00:00 2001 From: Andrew Gregory Date: Mon, 14 Sep 2015 18:37:40 -0400 Subject: check fileconflicts and diskspace outside commit This is necessary in order to be able to run PreTransaction hooks as close to the actual commit as possible so that we don't prematurely run hooks for a transaction that ultimately never happens. Signed-off-by: Andrew Gregory Signed-off-by: Allan McRae --- lib/libalpm/trans.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'lib/libalpm/trans.c') diff --git a/lib/libalpm/trans.c b/lib/libalpm/trans.c index 6a26e753..ed073c09 100644 --- a/lib/libalpm/trans.c +++ b/lib/libalpm/trans.c @@ -183,6 +183,10 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data) if(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY) { return 0; } + if(_alpm_sync_check(handle, data) != 0) { + /* pm_errno is set by _alpm_sync_check() */ + return -1; + } } trans->state = STATE_COMMITING; @@ -198,7 +202,7 @@ int SYMEXPORT alpm_trans_commit(alpm_handle_t *handle, alpm_list_t **data) return -1; } } else { - if(_alpm_sync_commit(handle, data) == -1) { + if(_alpm_sync_commit(handle) == -1) { /* pm_errno is set by _alpm_sync_commit() */ alpm_errno_t save = handle->pm_errno; alpm_logaction(handle, ALPM_CALLER_PREFIX, "transaction failed\n"); -- cgit v1.2.3-70-g09d2