Skip to content

Commit 13eb424

Browse files
AZero13millert
authored andcommitted
parse_args.c never says "the -E option is not valid in edit mode"
This is because we are checking the wrong variable.
1 parent 14c2046 commit 13eb424

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/parse_args.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,17 +559,17 @@ parse_args(int argc, char **argv, const char *shell, int *old_optind,
559559
}
560560
SET(flags, MODE_SHELL);
561561
}
562-
if ((flags & valid_flags) != flags)
563-
usage();
564562
if (mode == MODE_EDIT &&
565563
(ISSET(flags, MODE_PRESERVE_ENV) || extra_env.env_len != 0)) {
566-
if (ISSET(mode, MODE_PRESERVE_ENV))
564+
if (ISSET(flags, MODE_PRESERVE_ENV))
567565
sudo_warnx("%s", U_("the -E option is not valid in edit mode"));
568566
if (extra_env.env_len != 0)
569567
sudo_warnx("%s",
570568
U_("you may not specify environment variables in edit mode"));
571569
usage();
572570
}
571+
if ((flags & valid_flags) != flags)
572+
usage();
573573
if ((sudo_settings[ARG_RUNAS_USER].value != NULL ||
574574
sudo_settings[ARG_RUNAS_GROUP].value != NULL) &&
575575
!ISSET(mode, MODE_EDIT | MODE_RUN | MODE_CHECK | MODE_VALIDATE)) {

0 commit comments

Comments
 (0)