index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Pang Yan Han <pangyanhan@gmail.com> | 2011-08-30 00:58:48 +0800 |
---|---|---|
committer | Dan McGee <dan@archlinux.org> | 2011-08-29 20:17:08 -0500 |
commit | 2c5f000d5b2fd5db3b70670b835e6b932c0d10e3 (patch) | |
tree | 4bd8f0e39cd351a007d9cb46723b69f3b7561697 | |
parent | 234b6ffc2c39268d1efdc414e02bc4b352e5d931 (diff) |
-rw-r--r-- | src/pacman/sync.c | 1 | ||||
-rw-r--r-- | src/pacman/util.c | 22 | ||||
-rw-r--r-- | src/pacman/util.h | 1 |
diff --git a/src/pacman/sync.c b/src/pacman/sync.c index e97da37a..d553ba01 100644 --- a/src/pacman/sync.c +++ b/src/pacman/sync.c @@ -304,6 +304,7 @@ static int sync_synctree(int level, alpm_list_t *syncs) */ if(!success) { pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to synchronize any databases\n")); + trans_init_error(); } return (success > 0); } diff --git a/src/pacman/util.c b/src/pacman/util.c index 47fbaeb5..599c18c4 100644 --- a/src/pacman/util.c +++ b/src/pacman/util.c @@ -63,20 +63,24 @@ int trans_init(alpm_transflag_t flags, int check_valid) } if(ret == -1) { - enum _alpm_errno_t err = alpm_errno(config->handle); - pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), - alpm_strerror(err)); - if(err == ALPM_ERR_HANDLE_LOCK) { - fprintf(stderr, _(" if you're sure a package manager is not already\n" - " running, you can remove %s\n"), - alpm_option_get_lockfile(config->handle)); - } - + trans_init_error(); return -1; } return 0; } +void trans_init_error(void) +{ + enum _alpm_errno_t err = alpm_errno(config->handle); + pm_fprintf(stderr, ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"), + alpm_strerror(err)); + if(err == ALPM_ERR_HANDLE_LOCK) { + fprintf(stderr, _(" if you're sure a package manager is not already\n" + " running, you can remove %s\n"), + alpm_option_get_lockfile(config->handle)); + } +} + int trans_release(void) { if(alpm_trans_release(config->handle) == -1) { diff --git a/src/pacman/util.h b/src/pacman/util.h index 66698474..6a26b086 100644 --- a/src/pacman/util.h +++ b/src/pacman/util.h @@ -39,6 +39,7 @@ /* update speed for the fill_progress based functions */ #define UPDATE_SPEED_SEC 0.2f +void trans_init_error(void); int trans_init(alpm_transflag_t flags, int check_valid); int trans_release(void); int needs_root(void); |