mirror of
https://github.com/moparisthebest/pacman
synced 2024-11-15 13:55:09 -05:00
Johannes Weiner <hannes@saeurebad.de>
* package cleanup (pkg_invalid) refactoring
This commit is contained in:
parent
e310209296
commit
d27e5efec9
@ -271,27 +271,15 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||||||
/* parse the info file */
|
/* parse the info file */
|
||||||
if(parse_descfile(descfile, info, 0) == -1) {
|
if(parse_descfile(descfile, info, 0) == -1) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
|
_alpm_log(PM_LOG_ERROR, _("could not parse the package description file"));
|
||||||
pm_errno = PM_ERR_PKG_INVALID;
|
goto pkg_invalid;
|
||||||
unlink(descfile);
|
|
||||||
FREE(descfile);
|
|
||||||
close(fd);
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
if(!strlen(info->name)) {
|
if(!strlen(info->name)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("missing package name in %s"), pkgfile);
|
_alpm_log(PM_LOG_ERROR, _("missing package name in %s"), pkgfile);
|
||||||
pm_errno = PM_ERR_PKG_INVALID;
|
goto pkg_invalid;
|
||||||
unlink(descfile);
|
|
||||||
FREE(descfile);
|
|
||||||
close(fd);
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
if(!strlen(info->version)) {
|
if(!strlen(info->version)) {
|
||||||
_alpm_log(PM_LOG_ERROR, _("missing package version in %s"), pkgfile);
|
_alpm_log(PM_LOG_ERROR, _("missing package version in %s"), pkgfile);
|
||||||
pm_errno = PM_ERR_PKG_INVALID;
|
goto pkg_invalid;
|
||||||
unlink(descfile);
|
|
||||||
FREE(descfile);
|
|
||||||
close(fd);
|
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
config = 1;
|
config = 1;
|
||||||
unlink(descfile);
|
unlink(descfile);
|
||||||
@ -361,6 +349,11 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile)
|
|||||||
|
|
||||||
return(info);
|
return(info);
|
||||||
|
|
||||||
|
pkg_invalid:
|
||||||
|
pm_errno = PM_ERR_PKG_INVALID;
|
||||||
|
unlink(descfile);
|
||||||
|
FREE(descfile);
|
||||||
|
close(fd);
|
||||||
error:
|
error:
|
||||||
FREEPKG(info);
|
FREEPKG(info);
|
||||||
archive_read_finish (archive);
|
archive_read_finish (archive);
|
||||||
|
Loading…
Reference in New Issue
Block a user