Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Jul 2010 21:43:18 GMT
From:      Julien Laffaye <jlaffaye@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 181284 for review
Message-ID:  <201007212143.o6LLhI1R029659@repoman.freebsd.org>

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

Change 181284 by jlaffaye@jlaffaye-chulak on 2010/07/21 21:43:07

	Do not extract files on fake mode (!!!)
	Error checking.
	Use Boolean type when appropriate.

Affected files ...

.. //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#4 edit

Differences ...

==== //depot/projects/soc2010/pkg_complete/usr.sbin/pkg_install/add/extract.c#4 (text+ko) ====

@@ -43,7 +43,7 @@
 
 	char **matched;
 	char *conflict[2];
-	int conflictsfound = 0;
+	Boolean conflictsfound = FALSE;
 	int code = 0;
 	int errcode = 0;
 	char cmd[FILENAME_MAX];
@@ -144,11 +144,11 @@
 			    if (isinstalledpkg(matched[i]) > 0) {
 				warnx("package '%s' conflicts with %s",
 				      pkg.name, matched[i]);
-				conflictsfound = 1;
+				conflictsfound = TRUE;
 			    }
 		}
 	    }
-	    if(conflictsfound) {
+	    if(conflictsfound == TRUE) {
 		if(!Force) {
 		    warnx("please use pkg_delete first to remove conflicting "
 			  "package(s) or -f to force installation");
@@ -400,7 +400,14 @@
 		    printf("extract: %s/%s\n", last_dir, p->name);
 		if (archive_read_next_header(a, &entry) == ARCHIVE_OK) {
 		    assert(strcmp(p->name, archive_entry_pathname(entry)) == 0);
-		    archive_read_extract(a, entry, ARCHIVE_EXTRACT_PERM);
+		    if (!Fake &&
+			archive_read_extract(a, entry, ARCHIVE_EXTRACT_PERM) !=
+			ARCHIVE_OK) {
+			warnx("Can not extract '%s': %s",
+			      archive_entry_pathname(entry),
+			      archive_error_string(a));
+			return (1);
+		    }
 		} else {
 		    warnx("Can not read archive: %s", archive_error_string(a));
 		    return (1);



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