Corrects the partial initialization of the struct argp_option, which
previously had only 5 out of its 6 members initialized. This commit
ensures full initialization of all members by leveraging C99's
designated initializers.
tools/bg_envtools.h | 9 ++++++---
tools/bg_printenv.c | 2 +-
tools/bg_setenv.c | 2 +-
3 files changed, 8 insertions(+), 5 deletions(-)
diff --git a/tools/bg_envtools.h b/tools/bg_envtools.h
index 895b53f..8081d86 100644
--- a/tools/bg_envtools.h
+++ b/tools/bg_envtools.h
@@ -18,9 +18,12 @@
#include "env_api.h"
-#define OPT(name, key, arg, flags, doc) \
- { \
- name, key, arg, flags, doc \
+#define OPT(_name, _key, _arg, _flags, _doc) \
+ { .name = (_name) \
+ , .key = (_key) \
+ , .arg = (_arg) \
+ , .flags = (_flags) \
+ , .doc = (_doc) \
}
/* if you change these, do not forget to update completion/common.py */
diff --git a/tools/bg_printenv.c b/tools/bg_printenv.c
index 69d428b..9c52505 100644
--- a/tools/bg_printenv.c
+++ b/tools/bg_printenv.c
@@ -32,7 +32,7 @@ static struct argp_option options_printenv[] = {
"watchdog_timeout, ustate, user. "
"If omitted, all available fields are printed."),
OPT("raw", 'r', 0, 0, "Raw output mode, e.g. for shell scripting"),
- {},
+ {0},
};
/* Arguments used by bg_printenv. */
diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index ab2e2ad..f318f12 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -42,7 +42,7 @@ static struct argp_option options_setenv[] = {
"use this option multiple times."),
OPT("in_progress", 'i', "IN_PROGRESS", 0,
"Set in_progress variable to simulate a running update process."),
- {},
+ {0},
};
/* Arguments used by bg_setenv. */
--
2.41.0