summaryrefslogtreecommitdiffstats
path: root/src/pacman/add.c
diff options
context:
space:
mode:
authorStefano Esposito <stefano.esposito87@gmail.com>2007-09-08 18:41:45 +0200
committerDan McGee <dan@archlinux.org>2007-09-12 03:58:27 +0200
commit27acdc2c94de558103eb29260c179a49c9b05c14 (patch)
tree969d73111d6a1943975fae23ac5ba5747bb6e0d2 /src/pacman/add.c
parentf21c45c0ddf195a4dcfca08c19bfa23d1c7fb326 (diff)
downloadpacman-27acdc2c94de558103eb29260c179a49c9b05c14.tar.gz
pacman-27acdc2c94de558103eb29260c179a49c9b05c14.tar.xz
make alpm_strerror binding friendly
I'm currently working on python bindings for alpm written in pyrex. While working i found that declaring alpm_strerror as char * alpm_strerror (void) instead of char * alpm_strerror (int err) and then using pm_errno in the implementation instead of err, could make it more bindings-friendly. Dan: cleaned up and added void to declaration. Instead of replacing existing function, add a new function called 'alpm_strerrorlast(void)'. Signed-off-by: Stefano Esposito <stefano.esposito87@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
Diffstat (limited to 'src/pacman/add.c')
-rw-r--r--src/pacman/add.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/pacman/add.c b/src/pacman/add.c
index 67633e9c..0b59a236 100644
--- a/src/pacman/add.c
+++ b/src/pacman/add.c
@@ -42,7 +42,7 @@ static int add_cleanup(void)
int ret = alpm_trans_release();
if(ret != 0) {
pm_printf(PM_LOG_ERROR, _("failed to release transaction (%s)\n"),
- alpm_strerror(pm_errno));
+ alpm_strerrorlast());
ret = 1;
}
@@ -105,7 +105,7 @@ int pacman_add(alpm_list_t *targets)
if(alpm_trans_init(transtype, config->flags, cb_trans_evt,
cb_trans_conv, cb_trans_progress) == -1) {
/* TODO: error messages should be in the front end, not the back */
- fprintf(stderr, _("error: %s\n"), alpm_strerror(pm_errno));
+ fprintf(stderr, _("error: %s\n"), alpm_strerrorlast());
if(pm_errno == PM_ERR_HANDLE_LOCK) {
/* TODO this and the 2 other places should probably be on stderr */
printf(_(" if you're sure a package manager is not already\n"
@@ -120,7 +120,7 @@ int pacman_add(alpm_list_t *targets)
char *targ = alpm_list_getdata(i);
if(alpm_trans_addtarget(targ) == -1) {
fprintf(stderr, _("error: failed to add target '%s' (%s)"), targ,
- alpm_strerror(pm_errno));
+ alpm_strerrorlast());
add_cleanup();
return(1);
}
@@ -131,7 +131,7 @@ int pacman_add(alpm_list_t *targets)
/* TODO: No, compute nothing. This is stupid. */
if(alpm_trans_prepare(&data) == -1) {
fprintf(stderr, _("error: failed to prepare transaction (%s)\n"),
- alpm_strerror(pm_errno));
+ alpm_strerrorlast());
switch(pm_errno) {
case PM_ERR_UNSATISFIED_DEPS:
for(i = data; i; i = alpm_list_next(i)) {
@@ -197,7 +197,7 @@ int pacman_add(alpm_list_t *targets)
/* Step 3: perform the installation */
if(alpm_trans_commit(NULL) == -1) {
- fprintf(stderr, _("error: failed to commit transaction (%s)\n"), alpm_strerror(pm_errno));
+ fprintf(stderr, _("error: failed to commit transaction (%s)\n"), alpm_strerrorlast());
add_cleanup();
return(1);
}