Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 15 Sep 2019 02:37:28 +0000 (UTC)
From:      Kyle Evans <kevans@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org
Subject:   svn commit: r352345 - stable/11/sbin/bectl
Message-ID:  <201909150237.x8F2bSpK006537@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kevans
Date: Sun Sep 15 02:37:28 2019
New Revision: 352345
URL: https://svnweb.freebsd.org/changeset/base/352345

Log:
  MFC r352092: bectl(8): initialize reverse earlier
  
  This turns into a warning in GCC 4.2 that 'reverse' may be used
  uninitialized in this function. While I don't immediately see where it's
  deciding this from (there's only two paths that make column != NULL, and
  they both set reverse), initializing reverse earlier is good for clarity.

Modified:
  stable/11/sbin/bectl/bectl_list.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sbin/bectl/bectl_list.c
==============================================================================
--- stable/11/sbin/bectl/bectl_list.c	Sun Sep 15 02:36:50 2019	(r352344)
+++ stable/11/sbin/bectl/bectl_list.c	Sun Sep 15 02:37:28 2019	(r352345)
@@ -412,6 +412,7 @@ bectl_cmd_list(int argc, char *argv[])
 	props = NULL;
 	printed = 0;
 	bzero(&pc, sizeof(pc));
+	reverse = false;
 	while ((opt = getopt(argc, argv, "aDHsc:C:")) != -1) {
 		switch (opt) {
 		case 'a':
@@ -463,10 +464,8 @@ bectl_cmd_list(int argc, char *argv[])
 	}
 
 	/* List boot environments in alphabetical order by default */
-	if (column == NULL) {
+	if (column == NULL)
 		column = strdup("name");
-		reverse = false;
-	}
 
 	prop_list_sort(props, column, reverse);
 



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