From a58f19e687c69160eea4ffb6b7cae6aa629f8283 Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Mon, 9 Sep 2019 18:17:30 +0000 Subject: [PATCH] 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. MFC after: 3 days --- sbin/bectl/bectl_list.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/sbin/bectl/bectl_list.c b/sbin/bectl/bectl_list.c index 620888a9fa00..6eaa960acce7 100644 --- a/sbin/bectl/bectl_list.c +++ b/sbin/bectl/bectl_list.c @@ -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);