index : pacman | |
Archlinux32 fork of pacman | gitolite user |
summaryrefslogtreecommitdiff |
author | Aurelien Foret <aurelien@archlinux.org> | 2005-03-16 19:15:03 +0000 |
---|---|---|
committer | Aurelien Foret <aurelien@archlinux.org> | 2005-03-16 19:15:03 +0000 |
commit | ba13bc8b7b5be371d796b201b23988fef4d6bc82 (patch) | |
tree | c041a79d037f77e1716d27ff6d3edeb979fbc4ee /lib | |
parent | 467b83aed4af4536f0eae2b022c2468e9349698a (diff) |
-rw-r--r-- | lib/libalpm/add.c | 15 |
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c index 661708bf..325dbc86 100644 --- a/lib/libalpm/add.c +++ b/lib/libalpm/add.c @@ -68,24 +68,23 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name) /* no additional hyphens in version strings */ if(strchr(info->version, '-') != strrchr(info->version, '-')) { - FREEPKG(info); pm_errno = PM_ERR_INVALID_NAME; - return(-1); + goto error; } dummy = db_get_pkgfromcache(db, info->name); /* only freshen this package if it is already installed and at a lesser version */ if(trans->flags & PM_TRANS_FLAG_FRESHEN) { if(dummy == NULL || rpmvercmp(dummy->version, info->version) >= 0) { - FREEPKG(info); - PM_RET_ERR(PM_ERR_PKG_CANT_FRESH, -1); + pm_errno = PM_ERR_PKG_CANT_FRESH; + goto error; } } /* only install this package if it is not already installed */ if(trans->type != PM_TRANS_TYPE_UPGRADE) { if(dummy) { - FREEPKG(info); - PM_RET_ERR(PM_ERR_PKG_INSTALLED, -1); + pm_errno = PM_ERR_PKG_INSTALLED; + goto error; } } @@ -109,6 +108,10 @@ int add_loadtarget(pmdb_t *db, pmtrans_t *trans, char *name) trans->packages = pm_list_add(trans->packages, info); return(0); + +error: + FREEPKG(info); + return(-1); } int add_prepare(pmdb_t *db, pmtrans_t *trans, PMList **data) |