From: Tobias Brunner Date: Fri, 29 Jun 2018 09:30:31 +0000 (+0200) Subject: settings: Fix compilation with newer versions of Clang X-Git-Tag: 5.7.0dr5~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=daa0a0cc1bb5e0dc84c958441b756bcae584268b;p=thirdparty%2Fstrongswan.git settings: Fix compilation with newer versions of Clang Depending on the actual va_list definition it's not valid to compare it directly or assign NULL. --- diff --git a/src/libstrongswan/settings/settings.c b/src/libstrongswan/settings/settings.c index 1224c74176..dfa8651033 100644 --- a/src/libstrongswan/settings/settings.c +++ b/src/libstrongswan/settings/settings.c @@ -81,11 +81,6 @@ static bool print_key(char *buf, int len, char *start, char *key, va_list args) char *pos = start; bool res; - if (!args) - { - return snprintf(buf, len, "%s", key) < len; - } - va_copy(copy, args); while (TRUE) { @@ -192,11 +187,16 @@ static array_t *find_sections(private_settings_t *this, section_t *section, /** * Resolve the given reference. Not thread-safe. + * Only a vararg function to get an empty va_list. */ static void resolve_reference(private_settings_t *this, section_ref_t *ref, - array_t **sections) + array_t **sections, ...) { - find_sections(this, this->top, ref->name, NULL, sections); + va_list args; + + va_start(args, sections); + find_sections(this, this->top, ref->name, args, sections); + va_end(args); } /**