Print address when failing to bind

This commit is contained in:
Erik Ekman 2021-06-04 18:38:16 +02:00
parent d02f1b4f41
commit 8041e0368c

View File

@ -205,7 +205,7 @@ open_dns_opt(struct sockaddr_storage *sockaddr, size_t sockaddr_len, int v6only)
#endif #endif
if (bind(fd, (struct sockaddr*) sockaddr, sockaddr_len) < 0) if (bind(fd, (struct sockaddr*) sockaddr, sockaddr_len) < 0)
err(1, "bind"); err(1, "bind() to %s", format_addr(sockaddr, sockaddr_len));
fprintf(stderr, "Opened IPv%d UDP socket\n", sockaddr->ss_family == AF_INET6 ? 6 : 4); fprintf(stderr, "Opened IPv%d UDP socket\n", sockaddr->ss_family == AF_INET6 ? 6 : 4);