optind needs to be set to 0 than 1

optind needs to be set to 0 than 1 to reinit its internal state (see
NOTES in man getopt(3)) for getopt_long() in hd-rum-transcode. If not
so, the leading '+' in optstring (== disallowing permutation) won't
be effective.
This commit is contained in:
Martin Pulec
2024-05-10 13:52:48 +02:00
parent 885534186b
commit 0c9745dfda

View File

@@ -371,6 +371,7 @@ static bool parse_opts_set_logging(int argc, char *argv[])
}
optind = 1;
}
optind = 0;
opterr = saved_opterr;
if (logging_lvl == 0) {
logging_lvl = getenv("ULTRAGRID_VERBOSE") != nullptr && strlen(getenv("ULTRAGRID_VERBOSE")) > 0 ? LOG_LEVEL_VERBOSE : log_level;