svn commit: r212067 - head/cddl/contrib/opensolaris/cmd/zpool

Pawel Jakub Dawidek pjd at FreeBSD.org
Tue Aug 31 19:01:46 UTC 2010


Author: pjd
Date: Tue Aug 31 19:01:46 2010
New Revision: 212067
URL: http://svn.freebsd.org/changeset/base/212067

Log:
  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 after:	2 weeks

Modified:
  head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c

Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c
==============================================================================
--- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Tue Aug 31 19:01:12 2010	(r212066)
+++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c	Tue Aug 31 19:01:46 2010	(r212067)
@@ -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);
 }


More information about the svn-src-all mailing list