From 7879e4bef7c158814a547d232f0bde8960ee1341 Mon Sep 17 00:00:00 2001 From: Chantry Xavier Date: Tue, 19 Feb 2008 21:57:40 +0100 Subject: 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 --- src/pacman/sync.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/pacman') 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); } -- cgit v1.2.3-70-g09d2