PERFORCE change 181284 for review

Julien Laffaye jlaffaye at FreeBSD.org
Wed Jul 21 21:43:19 UTC 2010


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

Change 181284 by jlaffaye at 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);


More information about the p4-projects mailing list