1
0
mirror of https://gitlab.xiph.org/xiph/ezstream.git synced 2024-09-15 04:08:07 -04:00

Fix command line parsing regression

This commit is contained in:
Moritz Grimm 2015-05-06 16:59:05 +00:00
parent 43e48648fa
commit 05c7e32997
2 changed files with 5 additions and 3 deletions

View File

@ -171,7 +171,7 @@ cfg_set_program_name(const char *progname, const char **errstrp)
int
cfg_set_program_config_type(enum cfg_config_type type, const char **errstrp)
{
if (type >= CFG_TYPE_MAX) {
if (CFG_TYPE_MIN > type || CFG_TYPE_MAX < type) {
if (NULL != errstrp)
*errstrp = "invalid";
return (-1);

View File

@ -20,6 +20,7 @@
#include "compat.h"
#include <assert.h>
#include <stdio.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
@ -105,8 +106,9 @@ cmdline_parse(int argc, char *argv[], int *ret_p)
switch (ch) {
case OPT_CONFIGFILE:
if (0 > cfg_set_program_config_file(optarg, &err_str) ||
0 > cfg_set_program_config_type(CFG_TYPE_XMLFILE, NULL)) {
assert(0 == cfg_set_program_config_type(CFG_TYPE_XMLFILE,
NULL));
if (0 > cfg_set_program_config_file(optarg, &err_str)) {
fprintf(stderr, "-%c: argument %s\n",
OPT_CONFIGFILE, err_str);
_usage();