Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 3 Mar 2011 21:56:08 +0000 (UTC)
From:      Martin Matuska <mm@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-8@freebsd.org
Subject:   svn commit: r219253 - in stable/8/cddl/contrib/opensolaris/cmd: zpool ztest
Message-ID:  <201103032156.p23Lu8WC080935@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
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/");



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