Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 May 2010 15:54:22 GMT
From:      Garrett Cooper <gcooper@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 178147 for review
Message-ID:  <201005121554.o4CFsMw5025223@repoman.freebsd.org>

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

Change 178147 by gcooper@starr-bastion on 2010/05/12 15:53:44

	Fix an uncaught error when open(2) fails. Fix some bass ackwards inverted logic while I'm here.

Affected files ...

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

Differences ...

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

@@ -425,10 +425,8 @@
 	 * If the package tarball exists already, and we are running in
 	 * `no clobber' mode, skip this package.
 	 */
-	else if ((archive_fd = open(tball, archive_open_flags)) == -1) {
-		if (Verbose)
-			warn("Skipping package creation for: '%s'", tball);
-	}
+	else if ((archive_fd = open(tball, archive_open_flags)) == -1)
+		error = strerror(errno);
 	else if ((archive = archive_write_new()) == NULL)
 		error = strerror(errno);
 	else if (archive_write_set_format_ustar(archive) != ARCHIVE_OK)
@@ -477,10 +475,10 @@
 
 	}
 
-	if (error != NULL &&
+	if (error == NULL &&
 	    archive_write_open_fd(archive, archive_fd) != ARCHIVE_OK)
 		error = archive_error_string(archive);
-	if (error != NULL) {
+	if (error == NULL) {
 
 		if (Verbose)
 			printf("Creating %sed tar ball in '%s'\n",
@@ -537,7 +535,7 @@
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);
 
-			if (error != NULL)
+			if (error == NULL)
 				if (strlcat(destfile, p->name, PATH_MAX) >
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);
@@ -548,7 +546,7 @@
 				    PATH_MAX) > PATH_MAX)
 					error = strerror(ENAMETOOLONG);
 
-			if (error != NULL)
+			if (error == NULL)
 				if (strlcat(srcfile, p->name, PATH_MAX) >
 				    PATH_MAX)
 					error = strerror(ENAMETOOLONG);



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