From: Todd C. Miller Date: Wed, 29 Aug 2018 16:57:37 +0000 (-0600) Subject: No need to set input_file for stdin in parse_ldif(); noted by clang analyzer. X-Git-Tag: SUDO_1_8_25^2~10 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=58445393a75875a55ac2c46572c202e31c6253dd;p=sudo No need to set input_file for stdin in parse_ldif(); noted by clang analyzer. --- diff --git a/plugins/sudoers/cvtsudoers.c b/plugins/sudoers/cvtsudoers.c index 0a320496f..59ee1e42b 100644 --- a/plugins/sudoers/cvtsudoers.c +++ b/plugins/sudoers/cvtsudoers.c @@ -586,18 +586,17 @@ static bool parse_ldif(struct sudoers_parse_tree *parse_tree, const char *input_file, struct cvtsudoers_config *conf) { - FILE *fp; + FILE *fp = stdin; debug_decl(parse_ldif, SUDOERS_DEBUG_UTIL) /* Open LDIF file and parse it. */ - if (strcmp(input_file, "-") == 0) { - fp = stdin; - input_file = "stdin"; - } else if ((fp = fopen(input_file, "r")) == NULL) - sudo_fatal(U_("unable to open %s"), input_file); + if (strcmp(input_file, "-") != 0) { + if ((fp = fopen(input_file, "r")) == NULL) + sudo_fatal(U_("unable to open %s"), input_file); + } debug_return_bool(sudoers_parse_ldif(parse_tree, fp, conf->sudoers_base, - conf->store_options)); + conf->store_options)); } static bool