1
0
mirror of https://github.com/moparisthebest/pacman synced 2024-08-13 17:03:46 -04:00

code cleanup

This commit is contained in:
Aurelien Foret 2006-01-13 21:16:49 +00:00
parent e3cc4150f6
commit b014cdbe8b

View File

@ -70,7 +70,7 @@ int pacman_add(list_t *targets)
for(i = targets; i; i = i->next) { for(i = targets; i; i = i->next) {
if(alpm_trans_addtarget(i->data) == -1) { if(alpm_trans_addtarget(i->data) == -1) {
ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno)); ERR(NL, "failed to add target '%s' (%s)\n", (char *)i->data, alpm_strerror(pm_errno));
return(1); goto error;
} }
} }
MSG(CL, "done."); MSG(CL, "done.");
@ -116,18 +116,23 @@ int pacman_add(list_t *targets)
default: default:
break; break;
} }
alpm_trans_release(); goto error;
return(1);
} }
/* Step 3: actually perform the installation /* Step 3: actually perform the installation
*/ */
if(alpm_trans_commit(NULL) == -1) { if(alpm_trans_commit(NULL) == -1) {
ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno)); ERR(NL, "failed to commit transaction (%s)\n", alpm_strerror(pm_errno));
return(1); goto error;
} }
return(0); return(0);
error:
if(alpm_trans_release() == -1) {
ERR(NL, "failed to release transaction (%s)\n", alpm_strerror(pm_errno));
}
return(1);
} }
/* vim: set ts=2 sw=2 noet: */ /* vim: set ts=2 sw=2 noet: */