Convert perror/printf calls to wpa_printf

This makes debug and error logging more consistent and allows them to be
directed to a file more easily.

Signed-hostap: Jouni Malinen <j@w1.fi>
This commit is contained in:
Jouni Malinen 2013-11-02 12:51:30 +02:00
parent 8f47f31dd8
commit 61323e70e1
12 changed files with 156 additions and 143 deletions

View file

@ -630,7 +630,7 @@ static int eap_sim_db_open_socket(struct eap_sim_db_data *data)
data->sock = socket(PF_UNIX, SOCK_DGRAM, 0);
if (data->sock < 0) {
perror("socket(eap_sim_db)");
wpa_printf(MSG_INFO, "socket(eap_sim_db): %s", strerror(errno));
return -1;
}
@ -641,7 +641,7 @@ static int eap_sim_db_open_socket(struct eap_sim_db_data *data)
os_free(data->local_sock);
data->local_sock = os_strdup(addr.sun_path);
if (bind(data->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("bind(eap_sim_db)");
wpa_printf(MSG_INFO, "bind(eap_sim_db): %s", strerror(errno));
close(data->sock);
data->sock = -1;
return -1;
@ -651,7 +651,8 @@ static int eap_sim_db_open_socket(struct eap_sim_db_data *data)
addr.sun_family = AF_UNIX;
os_strlcpy(addr.sun_path, data->fname + 5, sizeof(addr.sun_path));
if (connect(data->sock, (struct sockaddr *) &addr, sizeof(addr)) < 0) {
perror("connect(eap_sim_db)");
wpa_printf(MSG_INFO, "connect(eap_sim_db): %s",
strerror(errno));
wpa_hexdump_ascii(MSG_INFO, "HLR/AuC GW socket",
(u8 *) addr.sun_path,
os_strlen(addr.sun_path));
@ -804,7 +805,8 @@ static int eap_sim_db_send(struct eap_sim_db_data *data, const char *msg,
if (send(data->sock, msg, len, 0) < 0) {
_errno = errno;
perror("send[EAP-SIM DB UNIX]");
wpa_printf(MSG_INFO, "send[EAP-SIM DB UNIX]: %s",
strerror(errno));
}
if (_errno == ENOTCONN || _errno == EDESTADDRREQ || _errno == EINVAL ||
@ -816,7 +818,8 @@ static int eap_sim_db_send(struct eap_sim_db_data *data, const char *msg,
wpa_printf(MSG_DEBUG, "EAP-SIM DB: Reconnected to the "
"external server");
if (send(data->sock, msg, len, 0) < 0) {
perror("send[EAP-SIM DB UNIX]");
wpa_printf(MSG_INFO, "send[EAP-SIM DB UNIX]: %s",
strerror(errno));
return -1;
}
}