diff --git a/src/shared/options.c b/src/shared/options.c index c5e7057bf8..09b677f813 100644 --- a/src/shared/options.c +++ b/src/shared/options.c @@ -95,7 +95,7 @@ int option_parse( /* Look for the next option */ - const Option *option; + const Option *option = NULL; /* initialization to appease gcc 13 */ const char *optname = NULL, *optval = NULL; _cleanup_free_ char *_optname = NULL; /* allocated option name */ bool separate_optval = false; @@ -206,6 +206,8 @@ int option_parse( } } + assert(option); + if (optval && !option_takes_arg(option)) return log_error_errno(SYNTHETIC_ERRNO(EINVAL), "%s: option '%s' doesn't allow an argument",