Do not rely on parsing order for arg validation.
Signed-off-by: Michael Adler <[email protected]>
---
tools/bg_setenv.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/tools/bg_setenv.c b/tools/bg_setenv.c
index ec0aa31..3e76156 100644
--- a/tools/bg_setenv.c
+++ b/tools/bg_setenv.c
@@ -393,13 +393,6 @@ static error_t parse_opt(int key, char *arg, struct
argp_state *state)
(uint8_t *)"0", 2);
break;
case 'u':
- if (arguments->part_specified) {
- fprintf(stderr,
- "Error, both automatic and manual partition "
- "selection. Cannot use -p and -u "
- "simultaneously.\n");
- return 1;
- }
arguments->auto_update = true;
break;
case 'v':
@@ -690,6 +683,13 @@ int main(int argc, char **argv)
int result = 0;
+ if (arguments.auto_update && arguments.part_specified) {
+ fprintf(stderr, "Error, both automatic and manual partition "
+ "selection. Cannot use -p and -u "
+ "simultaneously.\n");
+ return 1;
+ }
+
/* arguments are parsed, journal is filled */
/* is output to file or input from file ? */
--
2.33.0
--
You received this message because you are subscribed to the Google Groups "EFI
Boot Guard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/efibootguard-dev/20211103145707.3012399-6-michael.adler%40siemens.com.