PERFORCE change 178877 for review

Garrett Cooper gcooper at FreeBSD.org
Thu May 27 11:27:23 UTC 2010


http://p4web.freebsd.org/@@178877?ac=10

Change 178877 by gcooper at gcooper-bayonetta on 2010/05/27 11:26:31

	Reorder fields for alignment, and properly capture and playback errors
	from read_plist.

Affected files ...

.. //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/delete/perform.c#7 edit

Differences ...

==== //depot/projects/soc2007/gcooper-pkg_install-enhancements-simplified/usr.sbin/pkg_install/delete/perform.c#7 (text+ko) ====

@@ -22,6 +22,8 @@
 __FBSDID("$FreeBSD: src/usr.sbin/pkg_install/delete/perform.c,v 1.46 2010/04/23 11:07:43 flz Exp $");
 
 #include <err.h>
+#include <errno.h>
+
 #include <pkg.h>
 #include "delete.h"
 
@@ -122,19 +124,22 @@
 static int
 pkg_do(char *pkg)
 {
+    PackingList p;
+    struct stat sb;
+    struct reqr_by_entry *rb_entry;
+    struct reqr_by_head *rb_list;
     char *deporigin, **deporigins = NULL, **depnames = NULL, ***depmatches, home[FILENAME_MAX];
-    PackingList p;
+    const char *pre_script = DEINSTALL_FNAME;
+    const char *post_script, *pre_arg, *post_arg;
     int cfile;
-    int i, len;
+    int i;
+    int len;
     int isinstalled;
     /* support for separate pre/post install scripts */
     int new_m = 0, dep_count = 0;
-    const char *pre_script = DEINSTALL_FNAME;
-    const char *post_script, *pre_arg, *post_arg;
-    struct reqr_by_entry *rb_entry;
-    struct reqr_by_head *rb_list;
     int fd;
-    struct stat sb;
+    int rc;
+    int serrno;
 
     if (!pkg || !(len = strlen(pkg)))
 	return 1;
@@ -213,8 +218,13 @@
     /* If we have a prefix, add it now */
     if (Prefix)
 	add_plist(&Plist, PLIST_CWD, Prefix);
-    read_plist(&Plist, cfile);
+    rc = read_plist(&Plist, cfile);
+    serrno = errno;
     (void) close(cfile);
+    if (rc == -1) {
+	warnx("error occurred when reading plist: %s", strerror(serrno));
+	return 1;
+    }
     p = find_plist(&Plist, PLIST_CWD);
 
     if (!p) {


More information about the p4-projects mailing list