diff options
author | Omar Polo <op@omarpolo.com> | 2024-05-29 08:03:59 +0000 |
---|---|---|
committer | Omar Polo <op@omarpolo.com> | 2024-05-29 08:03:59 +0000 |
commit | cd12ad1132f5560e11c7f1e6f2d436edafbd2641 (patch) | |
tree | 06b0dd0e827f4b9b43061a84041789d6cddfee4a /server.c | |
parent | b2782022c92840866f5c97f053b7f0ba881fd41c (diff) |
pretty-print the socket address at configuration parsing time
saves a getnameinfo(NI_NUMERICHOST) at runtime, even if it's pretty
cheap.
Diffstat (limited to 'server.c')
-rw-r--r-- | server.c | 11 |
1 files changed, 2 insertions, 9 deletions
@@ -119,15 +119,8 @@ match_host(struct vhost *v, struct client *c) if (addr == NULL) return 0; - if (*c->domain == '\0') { - if (getnameinfo((struct sockaddr *)&addr->ss, addr->slen, - c->domain, sizeof(c->domain), NULL, 0, - NI_NUMERICHOST) == -1) { - log_warn("failed to fill the domain; getnameinfo"); - *c->domain = '\0'; - return 0; - } - } + if (*c->domain == '\0') + strlcpy(c->domain, addr->pp, sizeof(c->domain)); if (matches(v->domain, c->domain)) return 1; |