PERFORCE change 178919 for review
Garrett Cooper
gcooper at FreeBSD.org
Fri May 28 11:17:09 UTC 2010
http://p4web.freebsd.org/@@178919?ac=10
Change 178919 by gcooper at gcooper-bayonetta on 2010/05/28 11:16:18
Puke on bad plist info.
Affected files ...
.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/lib/libpkg/plist.c#7 edit
.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/info/perform.c#9 edit
Differences ...
==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/lib/libpkg/plist.c#7 (text+ko) ====
@@ -361,6 +361,7 @@
if (cmd == PLIST_PKGDEP) {
warnx("corrupted record (pkgdep line "
"without argument), ignoring");
+ errno = EINVAL;
cmd = rc = -1;
}
==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/info/perform.c#9 (text+ko) ====
@@ -22,7 +22,9 @@
__FBSDID("$FreeBSD: src/usr.sbin/pkg_install/info/perform.c,v 1.57 2010/04/23 11:07:43 flz Exp $");
#include <err.h>
+#include <errno.h>
#include <fcntl.h>
+#include <string.h>
#include <pkg.h>
#include "cleanup.h"
@@ -41,7 +43,8 @@
{
char **matched;
int err_cnt = 0;
- int i, errcode;
+ int errcode;
+ int i;
if (register_cleanup_handler(cleanup, NULL, NULL, 0) == -1)
err(EXIT_FAILURE, "failed to initialize exit handler");
@@ -99,6 +102,8 @@
const char *cp = NULL;
int code = 0;
int fd = -1;
+ int rc;
+ int serrno;
if (isURL(pkg)) {
if ((cp = fileGetURL(NULL, pkg, KeepPackage)) != NULL) {
@@ -181,8 +186,11 @@
goto bail;
}
/* If we have a prefix, add it now */
- read_plist(&plist, fd);
- close(fd);
+ rc = read_plist(&plist, fd);
+ serrno = errno;
+ (void) close(fd);
+ if (rc == -1)
+ errx(EXIT_FAILURE, "failure reading plist: %s", strerror(serrno));
/*
* Index is special info type that has to override all others to make
More information about the p4-projects
mailing list