Skip to content

Commit

Permalink
Merge branch 'tickets/DM-48646'
Browse files Browse the repository at this point in the history
  • Loading branch information
iagaponenko committed Feb 3, 2025
2 parents 4776612 + 3d14871 commit 0f409b1
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/util/common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ string get_current_host_fqdn(bool all) {
hints.ai_family = AF_UNSPEC; /* either IPV4 or IPV6 */
hints.ai_socktype = SOCK_STREAM; /* IP */
hints.ai_flags = AI_CANONNAME; /* canonical name */
hints.ai_canonname = NULL;
struct addrinfo* info;
while (true) {
int const retCode = getaddrinfo(hostname.data(), "http", &hints, &info);
Expand All @@ -63,6 +64,10 @@ string get_current_host_fqdn(bool all) {
}
string fqdn;
for (struct addrinfo* p = info; p != NULL; p = p->ai_next) {
if (p->ai_canonname == NULL) {
throw runtime_error("Registry::" + string(__func__) +
" getaddrinfo failed: ai_canonname is NULL");
}
if (!fqdn.empty()) {
if (!all) break;
fqdn += ",";
Expand Down

0 comments on commit 0f409b1

Please sign in to comment.