svn commit: r219253 - in stable/8/cddl/contrib/opensolaris/cmd: zpool ztest

Martin Matuska mm at FreeBSD.org
Thu Mar 3 21:56:08 UTC 2011


Author: mm
Date: Thu Mar  3 21:56:08 2011
New Revision: 219253
URL: http://svn.freebsd.org/changeset/base/219253

Log:
  MFC r212067, r214623
  
  MFC r212067 (pjd):
  Eliminate confusing while () loop. In the first version of the code it was
  there to avoid gotos, but in the current version it serves no purpose.
  
  MFC r214623 (pjd):
  Fix ztest when it is executed by just 'ztest' and not by full path
  '/usr/bin/ztest'.

Modified:
  stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
  stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c
Directory Properties:
  stable/8/cddl/contrib/opensolaris/   (props changed)

Modified: stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Mar  3 20:41:59 2011	(r219252)
+++ stable/8/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Thu Mar  3 21:56:08 2011	(r219253)
@@ -3347,20 +3347,19 @@ is_root_pool(zpool_handle_t *zhp)
 	static boolean_t stated = B_FALSE;
 	char *slash;
 
-	while (!stated) {
+	if (!stated) {
 		stated = B_TRUE;
 		if (statfs("/", &sfs) == -1) {
 			(void) fprintf(stderr,
 			    "Unable to stat root file system: %s.\n",
 			    strerror(errno));
-			break;
+			return (0);
 		}
 		if (strcmp(sfs.f_fstypename, "zfs") != 0)
-			break;
+			return (0);
 		poolname = sfs.f_mntfromname;
 		if ((slash = strchr(poolname, '/')) != NULL)
 			*slash = '\0';
-		break;
 	}
 	return (poolname != NULL && strcmp(poolname, zpool_get_name(zhp)) == 0);
 }

Modified: stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==============================================================================
--- stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Thu Mar  3 20:41:59 2011	(r219252)
+++ stable/8/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Thu Mar  3 21:56:08 2011	(r219253)
@@ -3362,8 +3362,7 @@ ztest_verify_blocks(char *pool)
 	int isalen;
 	FILE *fp;
 
-	if (realpath(progname, zdb) == NULL)
-		assert(!"realpath() failed");
+	strlcpy(zdb, "/usr/bin/ztest", sizeof(zdb));
 
 	/* zdb lives in /usr/sbin, while ztest lives in /usr/bin */
 	bin = strstr(zdb, "/usr/bin/");


More information about the svn-src-all mailing list