Fix namebuff overwrite leading to wrong log after socket bind warning.

This commit is contained in:
Simon Kelley
2022-09-09 15:56:54 +01:00
parent 1d53d958bb
commit e518e87533

View File

@@ -2439,12 +2439,12 @@ static int random_sock(struct server *s)
return fd; return fd;
if (s->interface[0] == 0) if (s->interface[0] == 0)
(void)prettyprint_addr(&s->source_addr, daemon->namebuff); (void)prettyprint_addr(&s->source_addr, daemon->addrbuff);
else else
strcpy(daemon->namebuff, s->interface); safe_strncpy(daemon->addrbuff, s->interface, ADDRSTRLEN);
my_syslog(LOG_ERR, _("failed to bind server socket to %s: %s"), my_syslog(LOG_ERR, _("failed to bind server socket to %s: %s"),
daemon->namebuff, strerror(errno)); daemon->addrbuff, strerror(errno));
close(fd); close(fd);
} }