[pacman-dev] CVS update of pacman-lib/lib/libalpm (package.c)
Aaron Griffin
aaron at archlinux.org
Fri Jan 19 18:44:50 EST 2007
Date: Friday, January 19, 2007 @ 18:44:50
Author: aaron
Path: /home/cvs-pacman/pacman-lib/lib/libalpm
Modified: package.c (1.47 -> 1.48)
Moved some decls to make the "pkg_invalid" patch compile again.
-----------+
package.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
Index: pacman-lib/lib/libalpm/package.c
diff -u pacman-lib/lib/libalpm/package.c:1.47 pacman-lib/lib/libalpm/package.c:1.48
--- pacman-lib/lib/libalpm/package.c:1.47 Fri Jan 19 13:06:37 2007
+++ pacman-lib/lib/libalpm/package.c Fri Jan 19 18:44:50 2007
@@ -235,6 +235,8 @@
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 @@
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 @@
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);
More information about the pacman-dev
mailing list