summaryrefslogtreecommitdiff
path: root/src/pacman/sync.c
diff options
context:
space:
mode:
authorAurelien Foret <aurelien@archlinux.org>2006-01-26 20:46:48 +0000
committerAurelien Foret <aurelien@archlinux.org>2006-01-26 20:46:48 +0000
commitfb2331ab8b62cb4737c5e31c4bee766c270b92f7 (patch)
treeb7102c35bbfa9a1de195a688dd3d36de9dd878d7 /src/pacman/sync.c
parent7818e6f74509fc56f75e8cdd22a4cc037668067f (diff)
- fixed a compilation warning
- added missing alpm_trans_release() calls upon transation completion - put back error messages from pacman 2.x in case of PM_ERR_HANDLE_LOCK error
Diffstat (limited to 'src/pacman/sync.c')
-rw-r--r--src/pacman/sync.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 88b7ed71..28c916ed 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -414,8 +414,11 @@ int pacman_sync(list_t *targets)
*/
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
- retval = 1;
- goto cleanup;
+ if(pm_errno == PM_ERR_HANDLE_LOCK) {
+ MSG(NL, " if you're sure a package manager is not already running,\n"
+ " you can remove %s\n", PM_LOCK);
+ }
+ return(1);
}
if(config->op_s_upgrade) {
@@ -450,8 +453,11 @@ int pacman_sync(list_t *targets)
}
if(alpm_trans_init(PM_TRANS_TYPE_SYNC, config->flags, cb_trans_evt, cb_trans_conv) == -1) {
ERR(NL, "failed to init transaction (%s)\n", alpm_strerror(pm_errno));
- retval = 1;
- goto cleanup;
+ if(pm_errno == PM_ERR_HANDLE_LOCK) {
+ MSG(NL, " if you're sure a package manager is not already running,\n"
+ " you can remove %s\n", PM_LOCK);
+ }
+ return(1);
}
if(alpm_trans_addtarget("pacman") == -1) {
ERR(NL, "could not add target '%s': %s\n", (char *)i->data, alpm_strerror(pm_errno));
@@ -524,7 +530,7 @@ int pacman_sync(list_t *targets)
for(lp = alpm_list_first(data); lp; lp = alpm_list_next(lp)) {
PM_DEPMISS *miss = alpm_list_getdata(lp);
MSG(NL, ":: %s: %s %s", alpm_dep_getinfo(miss, PM_DEP_TARGET),
- alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? "requires" : "is required by",
+ (int)alpm_dep_getinfo(miss, PM_DEP_TYPE) == PM_DEP_TYPE_DEPEND ? "requires" : "is required by",
alpm_dep_getinfo(miss, PM_DEP_NAME));
switch((int)alpm_dep_getinfo(miss, PM_DEP_MOD)) {
case PM_DEP_MOD_EQ: MSG(CL, "=%s", alpm_dep_getinfo(miss, PM_DEP_VERSION)); break;
@@ -779,8 +785,13 @@ int pacman_sync(list_t *targets)
}
}
+ /* Step 4: release transaction resources
+ */
cleanup:
- alpm_trans_release();
+ if(alpm_trans_release() == -1) {
+ ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
+ }
+
return(retval);
}