summaryrefslogtreecommitdiffstats
path: root/lib/libalpm/alpm.c
diff options
context:
space:
mode:
authorJudd Vinet <judd@archlinux.org>2006-07-15 01:15:07 +0200
committerJudd Vinet <judd@archlinux.org>2006-07-15 01:15:07 +0200
commit54008798efcc9646f622f6b052ecd83281d57cda (patch)
treef50aeec616897699713156468943dfc8f9923178 /lib/libalpm/alpm.c
parent318e233cb38635581b14e081c22e369265c753b8 (diff)
downloadpacman-54008798efcc9646f622f6b052ecd83281d57cda.tar.gz
pacman-54008798efcc9646f622f6b052ecd83281d57cda.tar.xz
Patch from FW: Better control over CTRL-C interruptions -- do not leave the DB in an inconsistent state
Diffstat (limited to 'lib/libalpm/alpm.c')
-rw-r--r--lib/libalpm/alpm.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/libalpm/alpm.c b/lib/libalpm/alpm.c
index cffbfc46..96d8536e 100644
--- a/lib/libalpm/alpm.c
+++ b/lib/libalpm/alpm.c
@@ -799,6 +799,14 @@ int alpm_trans_release()
ASSERT(trans != NULL, RET_ERR(PM_ERR_TRANS_NULL, -1));
ASSERT(trans->state != STATE_IDLE, RET_ERR(PM_ERR_TRANS_NULL, -1));
+ /* during a commit do not interrupt immediately, just after a target */
+ if(trans->state == STATE_COMMITTING || trans->state == STATE_INTERRUPTED) {
+ if(trans->state == STATE_COMMITTING) {
+ trans->state = STATE_INTERRUPTED;
+ }
+ return(-1);
+ }
+
FREETRANS(handle->trans);
/* unlock db */