mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-03-05 19:10:45 +00:00
MINOR: sock_inet: report the errno string in binding errors
With the socket binding code cleanup it becomes easy to add more info to error messages. One missing thing used to be the error string, which is now added after the generic one, for example: [ALERT] 260/082852 (12974) : Starting frontend f: cannot bind socket (Permission denied) [0.0.0.0:4] [ALERT] 260/083053 (13292) : Starting frontend f: cannot bind socket (Address already in use) [0.0.0.0:4444] [ALERT] 260/083104 (13298) : Starting frontend f: cannot bind socket (Cannot assign requested address) [1.1.1.1:4444]
This commit is contained in:
parent
eb8cfe6723
commit
36722d2274
@ -293,7 +293,7 @@ int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char *
|
||||
rx->proto->sock_type, rx->proto->sock_prot);
|
||||
if (fd == -1) {
|
||||
err |= ERR_RETRYABLE | ERR_ALERT;
|
||||
memprintf(errmsg, "cannot create receiving socket");
|
||||
memprintf(errmsg, "cannot create receiving socket (%s)", strerror(errno));
|
||||
goto bind_return;
|
||||
}
|
||||
}
|
||||
@ -347,7 +347,7 @@ int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char *
|
||||
if (setsockopt(fd, SOL_SOCKET, SO_BINDTODEVICE,
|
||||
rx->settings->interface,
|
||||
strlen(rx->settings->interface) + 1) == -1) {
|
||||
memprintf(errmsg, "cannot bind receiver to device");
|
||||
memprintf(errmsg, "cannot bind receiver to device (%s)", strerror(errno));
|
||||
err |= ERR_WARN;
|
||||
}
|
||||
}
|
||||
@ -369,7 +369,7 @@ int sock_inet_bind_receiver(struct receiver *rx, void (*handler)(int fd), char *
|
||||
|
||||
if (!ext && bind(fd, (struct sockaddr *)&addr_inet, rx->proto->fam->sock_addrlen) == -1) {
|
||||
err |= ERR_RETRYABLE | ERR_ALERT;
|
||||
memprintf(errmsg, "cannot bind socket");
|
||||
memprintf(errmsg, "cannot bind socket (%s)", strerror(errno));
|
||||
goto bind_close_return;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user