Make bind failure messages unique

This helps someone know which part of the code is complaining.

Signed-hostap: Ben Greear <greearb@candelatech.com>
This commit is contained in:
Ben Greear 2012-04-06 12:10:36 +03:00 committed by Jouni Malinen
parent bae489d292
commit 9d05374796
7 changed files with 12 additions and 11 deletions

View file

@ -893,7 +893,7 @@ int hostapd_ctrl_iface_init(struct hostapd_data *hapd)
}
if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) <
0) {
perror("bind(PF_UNIX)");
perror("hostapd-ctrl-iface: bind(PF_UNIX)");
goto fail;
}
wpa_printf(MSG_DEBUG, "Successfully replaced leftover "

View file

@ -96,7 +96,7 @@ static int open_socket(const char *path)
addr.sun_family = AF_UNIX;
os_strlcpy(addr.sun_path, path, sizeof(addr.sun_path));
if (bind(s, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("hlr-auc-gw: bind(PF_UNIX)");
close(s);
return -1;
}

View file

@ -651,7 +651,7 @@ static int wpa_driver_privsep_set_param(void *priv, const char *param)
os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
if (bind(drv->priv_socket, (struct sockaddr *) &addr, sizeof(addr)) <
0) {
perror("bind(PF_UNIX)");
perror("privsep-set-params priv-sock: bind(PF_UNIX)");
close(drv->priv_socket);
drv->priv_socket = -1;
unlink(drv->own_socket_path);
@ -676,7 +676,7 @@ static int wpa_driver_privsep_set_param(void *priv, const char *param)
os_strlcpy(addr.sun_path, drv->own_cmd_path, sizeof(addr.sun_path));
if (bind(drv->cmd_socket, (struct sockaddr *) &addr, sizeof(addr)) < 0)
{
perror("bind(PF_UNIX)");
perror("privsep-set-params cmd-sock: bind(PF_UNIX)");
close(drv->cmd_socket);
drv->cmd_socket = -1;
unlink(drv->own_cmd_path);

View file

@ -1275,7 +1275,7 @@ static void * test_driver_init(struct hostapd_data *hapd,
alen = sizeof(addr_un);
}
if (bind(drv->test_socket, addr, alen) < 0) {
perror("bind(PF_UNIX)");
perror("test-driver-init: bind(PF_UNIX)");
close(drv->test_socket);
if (drv->own_socket_path)
unlink(drv->own_socket_path);
@ -2252,7 +2252,7 @@ static int wpa_driver_test_attach(struct wpa_driver_test_data *drv,
os_strlcpy(addr.sun_path, drv->own_socket_path, sizeof(addr.sun_path));
if (bind(drv->test_socket, (struct sockaddr *) &addr,
sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("test-driver-attach: bind(PF_UNIX)");
close(drv->test_socket);
unlink(drv->own_socket_path);
os_free(drv->own_socket_path);

View file

@ -173,7 +173,7 @@ struct l2_packet_data * l2_packet_init(
addr.sun_family = AF_UNIX;
os_strlcpy(addr.sun_path, l2->own_socket_path, sizeof(addr.sun_path));
if (bind(l2->fd, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("l2-pkt-privsep: bind(PF_UNIX)");
goto fail;
}

View file

@ -375,7 +375,7 @@ wpa_supplicant_ctrl_iface_init(struct wpa_supplicant *wpa_s)
}
if (bind(priv->sock, (struct sockaddr *) &addr,
sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("supp-ctrl-iface-init: bind(PF_UNIX)");
goto fail;
}
wpa_printf(MSG_DEBUG, "Successfully replaced leftover "
@ -667,7 +667,8 @@ wpa_supplicant_global_ctrl_iface_init(struct wpa_global *global)
os_strlcpy(addr.sun_path, global->params.ctrl_interface,
sizeof(addr.sun_path));
if (bind(priv->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("supp-global-ctrl-iface-init (will try fixup): "
"bind(PF_UNIX)");
if (connect(priv->sock, (struct sockaddr *) &addr,
sizeof(addr)) < 0) {
wpa_printf(MSG_DEBUG, "ctrl_iface exists, but does not"
@ -682,7 +683,7 @@ wpa_supplicant_global_ctrl_iface_init(struct wpa_global *global)
}
if (bind(priv->sock, (struct sockaddr *) &addr,
sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("supp-glb-iface-init: bind(PF_UNIX)");
goto fail;
}
wpa_printf(MSG_DEBUG, "Successfully replaced leftover "

View file

@ -643,7 +643,7 @@ wpa_priv_interface_init(const char *dir, const char *params)
}
if (bind(iface->fd, (struct sockaddr *) &addr,
sizeof(addr)) < 0) {
perror("bind(PF_UNIX)");
perror("wpa-priv-iface-init: bind(PF_UNIX)");
goto fail;
}
wpa_printf(MSG_DEBUG, "Successfully replaced leftover "