Merge pull request #19175 from keszybz/maybe-unitialized-warning-2

Third batch of fixes and suppressions for maybe-unitialized warnings
This commit is contained in:
Luca Boccassi
2021-04-01 19:45:08 +01:00
committed by GitHub
10 changed files with 72 additions and 29 deletions
+8 -2
View File
@@ -938,6 +938,8 @@ static int answer_add_clamp_ttl(
if (FLAGS_SET(query_flags, SD_RESOLVED_CLAMP_TTL)) {
uint32_t left_ttl;
assert(current > 0);
/* Let's determine how much time is left for this cache entry. Note that we round down, but
* clamp this to be 1s at minimum, since we usually want records to remain cached better too
* short a time than too long a time, but otoh don't want to return 0 ever, since that has
@@ -988,7 +990,7 @@ int dns_cache_lookup(
bool nxdomain = false;
DnsCacheItem *j, *first, *nsec = NULL;
bool have_authenticated = false, have_non_authenticated = false, have_confidential = false, have_non_confidential = false;
usec_t current;
usec_t current = 0;
int found_rcode = -1;
DnssecResult dnssec_result = -1;
int have_dnssec_result = -1;
@@ -1014,8 +1016,12 @@ int dns_cache_lookup(
goto miss;
}
if (FLAGS_SET(query_flags, SD_RESOLVED_CLAMP_TTL))
if (FLAGS_SET(query_flags, SD_RESOLVED_CLAMP_TTL)) {
/* 'current' is always passed to answer_add_clamp_ttl(), but is only used conditionally.
* We'll do the same assert there to make sure that it was initialized properly. */
current = now(clock_boottime_or_monotonic());
assert(current > 0);
}
LIST_FOREACH(by_key, j, first) {
/* If the caller doesn't allow us to answer questions from cache data learned from