aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2024-05-29 08:03:59 +0000
committerOmar Polo <op@omarpolo.com>2024-05-29 08:03:59 +0000
commitcd12ad1132f5560e11c7f1e6f2d436edafbd2641 (patch)
tree06b0dd0e827f4b9b43061a84041789d6cddfee4a /server.c
parentb2782022c92840866f5c97f053b7f0ba881fd41c (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.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/server.c b/server.c
index b9bb0d8..8e39912 100644
--- a/server.c
+++ b/server.c
@@ -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;