summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorAaron Griffin <aaron@archlinux.org>2007-01-19 18:05:19 +0000
committerAaron Griffin <aaron@archlinux.org>2007-01-19 18:05:19 +0000
commitd27e5efec9b6571f4edfe46386c49c9cfc29815e (patch)
tree7dd3cca345b07bd279b27a63db2da88502fdf01d /lib
parente31020929644f4b0e20fb6712ffd4f7da44d519a (diff)
downloadpacman-d27e5efec9b6571f4edfe46386c49c9cfc29815e.tar.xz
Johannes Weiner <hannes@saeurebad.de>
* package cleanup (pkg_invalid) refactoring
Diffstat (limited to 'lib')
-rw-r--r--lib/libalpm/package.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c
index d741562d..1f572594 100644
--- a/lib/libalpm/package.c
+++ b/lib/libalpm/package.c
@@ -271,27 +271,15 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
/* parse the info file */
if(parse_descfile(descfile, info, 0) == -1) {
_alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
- pm_errno = PM_ERR_PKG_INVALID;
- unlink(descfile);
- FREE(descfile);
- close(fd);
- goto error;
+ goto pkg_invalid;
}
if(!strlen(info->name)) {
_alpm_log(PM_LOG_ERROR, _("missing package name in %s"), pkgfile);
- pm_errno = PM_ERR_PKG_INVALID;
- unlink(descfile);
- FREE(descfile);
- close(fd);
- goto error;
+ goto pkg_invalid;
}
if(!strlen(info->version)) {
_alpm_log(PM_LOG_ERROR, _("missing package version in %s"), pkgfile);
- pm_errno = PM_ERR_PKG_INVALID;
- unlink(descfile);
- FREE(descfile);
- close(fd);
- goto error;
+ goto pkg_invalid;
}
config = 1;
unlink(descfile);
@@ -361,6 +349,11 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
return(info);
+pkg_invalid:
+ pm_errno = PM_ERR_PKG_INVALID;
+ unlink(descfile);
+ FREE(descfile);
+ close(fd);
error:
FREEPKG(info);
archive_read_finish (archive);