Send patches - preferably formatted by git format-patch - to patches at archlinux32 dot org.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChantry Xavier <shiningxc@gmail.com>2008-02-19 21:57:40 +0100
committerDan McGee <dan@archlinux.org>2008-02-19 22:08:06 -0600
commit7879e4bef7c158814a547d232f0bde8960ee1341 (patch)
treed20aa4cfbf51816d3220e370b3c5d5bab2a4b4b1
parent6f3949e3da4325f61ac53d7c8b86a18ff6acb64e (diff)
Lock the database on -Sc operation.
This partly fixes FS#9609. Weird things could happen when running -Sc while another instance was already running. The cleancache function could delete packages that were just being downloaded. Signed-off-by: Chantry Xavier <shiningxc@gmail.com>
-rw-r--r--src/pacman/sync.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 5f83c753..e3e87703 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -774,8 +774,19 @@ int pacman_sync(alpm_list_t *targets)
/* clean the cache */
if(config->op_s_clean) {
- int ret = sync_cleancache(config->op_s_clean);
+ int ret = 0;
+
+ if(sync_trans_init(0) == -1) {
+ return(1);
+ }
+
+ ret += sync_cleancache(config->op_s_clean);
ret += sync_cleandb_all();
+
+ if(sync_trans_release() == -1) {
+ ret++;
+ }
+
return(ret);
}