hostname-wordlist: fix comment and downgrade warning

The comment was wrong. The average word is about 6 characters, so in
64 iterations, the probability of never landing on a word boundary is
~(1 - 1/7)**64, about 0.01%.
This commit is contained in:
Zbigniew Jędrzejewski-Szmek
2026-09-01 15:57:58 +02:00
parent c737b297a3
commit c47a5fa25b
+4 -3
View File
@@ -455,9 +455,10 @@ int hostname_pick_word(sd_id128_t mid, size_t pos, char **ret) {
/* Comment/empty/invalid line: resample rather than advancing, to keep the pick uniform. */
}
/* We exhausted the uniform attempts, this should never happen but if it does fallback to picking the
* next word after our last attempt. */
log_warning("hostname_pick_word did not find a usable word after %u in wordlist %zu", MAX_ITERATIONS, pos);
/* We exhausted the uniform attempts, this occasionally happens, so fall back to picking the next
* word after our last offset. */
log_debug("Falling back to linear scan for a word in wordlist %zu after trying %u random offsets.",
pos, MAX_ITERATIONS);
return pick_word_linear_scan(words, size, offset, ret);
}