Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 May 2010 11:17:08 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 178919 for review
Message-ID:  <201005281117.o4SBH8vI028162@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@178919?ac=10

Change 178919 by gcooper@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201005281117.o4SBH8vI028162>