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>
This commit is contained in:
Chantry Xavier 2008-02-19 21:57:40 +01:00 committed by Dan McGee
parent 6f3949e3da
commit 7879e4bef7

View file

@ -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);
}