diff options
author | Aaron Griffin <aaron@archlinux.org> | 2007-01-20 00:44:50 +0100 |
---|---|---|
committer | Aaron Griffin <aaron@archlinux.org> | 2007-01-20 00:44:50 +0100 |
commit | 35a9f3e7d0ffd6bfc6b8fa8d65ed5184eeadaaa4 (patch) | |
tree | 456a1d5dd135aeae1fbe06d850ff21b55350b3c6 /lib | |
parent | 77f6bcfa3dac534a03d1388eb95297570cc0e052 (diff) | |
download | pacman-35a9f3e7d0ffd6bfc6b8fa8d65ed5184eeadaaa4.tar.gz pacman-35a9f3e7d0ffd6bfc6b8fa8d65ed5184eeadaaa4.tar.xz |
Moved some decls to make the "pkg_invalid" patch compile again.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libalpm/package.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/lib/libalpm/package.c b/lib/libalpm/package.c index 7317982c..084b9014 100644 --- a/lib/libalpm/package.c +++ b/lib/libalpm/package.c @@ -235,6 +235,8 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile) register struct archive *archive; struct archive_entry *entry; pmpkg_t *info = NULL; + char *descfile = NULL; + int fd = -1; if(pkgfile == NULL || strlen(pkgfile) == 0) { RET_ERR(PM_ERR_WRONG_ARGS, NULL); @@ -261,9 +263,6 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile) break; } if(!strcmp(archive_entry_pathname (entry), ".PKGINFO")) { - char *descfile; - int fd; - /* extract this file into /tmp. it has info for us */ descfile = strdup("/tmp/alpm_XXXXXX"); fd = mkstemp(descfile); @@ -351,9 +350,13 @@ pmpkg_t *_alpm_pkg_load(char *pkgfile) pkg_invalid: pm_errno = PM_ERR_PKG_INVALID; - unlink(descfile); - FREE(descfile); - close(fd); + if(descfile) { + unlink(descfile); + FREE(descfile); + } + if(fd != -1) { + close(fd); + } error: FREEPKG(info); archive_read_finish (archive); |