From: Martin Willi Date: Wed, 5 Jun 2013 13:20:37 +0000 (+0200) Subject: attr: fix a compiler warning that family is used uninitialized (seen with -Os) X-Git-Tag: 5.1.0dr1~134 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=169bf6745e1957fb873671babb7ba64e97e7806d;p=thirdparty%2Fstrongswan.git attr: fix a compiler warning that family is used uninitialized (seen with -Os) --- diff --git a/src/libhydra/plugins/attr/attr_provider.c b/src/libhydra/plugins/attr/attr_provider.c index 329f317dd3..ae2c07368e 100644 --- a/src/libhydra/plugins/attr/attr_provider.c +++ b/src/libhydra/plugins/attr/attr_provider.c @@ -252,9 +252,21 @@ static void load_entries(private_attr_provider_t *this) } } host->destroy(host); + if (mapped) + { + switch (family) + { + case AF_INET: + type = mapped->v4; + break; + case AF_INET6: + type = mapped->v6; + break; + } + } } INIT(entry, - .type = type ?: (family == AF_INET ? mapped->v4 : mapped->v6), + .type = type, .value = data, ); DBG2(DBG_CFG, "loaded attribute %N: %#B", @@ -308,4 +320,3 @@ attr_provider_t *attr_provider_create(database_t *db) return &this->public; } -