mirror of
https://github.com/tio/tio.git
synced 2026-05-01 14:57:59 +02:00
Unify error message formating
This commit is contained in:
parent
bf749aead4
commit
0a892006ea
2 changed files with 8 additions and 8 deletions
10
src/socket.c
10
src/socket.c
|
|
@ -173,21 +173,21 @@ void socket_configure(void)
|
|||
sockfd = socket(socket_family, SOCK_STREAM, 0);
|
||||
if (sockfd < 0)
|
||||
{
|
||||
error_printf("Failed to create socket: %s", strerror(errno));
|
||||
error_printf("Failed to create socket (%s)", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Bind */
|
||||
if (bind(sockfd, sockaddr_p, socklen) < 0)
|
||||
{
|
||||
error_printf("Failed to bind to socket %s", strerror(errno));
|
||||
error_printf("Failed to bind to socket (%s)", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
/* Listen */
|
||||
if (listen(sockfd, MAX_SOCKET_CLIENTS) < 0)
|
||||
{
|
||||
error_printf("Failed to listen on socket %s", strerror(errno));
|
||||
error_printf("Failed to listen on socket (%s)", strerror(errno));
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
|
@ -217,7 +217,7 @@ void socket_write(char input_char)
|
|||
{
|
||||
if (write(clientfds[i], &input_char, 1) <= 0)
|
||||
{
|
||||
error_printf_silent("Failed to write to socket: %s", strerror(errno));
|
||||
error_printf_silent("Failed to write to socket (%s)", strerror(errno));
|
||||
close(clientfds[i]);
|
||||
clientfds[i] = -1;
|
||||
}
|
||||
|
|
@ -288,7 +288,7 @@ bool socket_handle_input(fd_set *rdfs, char *output_char)
|
|||
}
|
||||
if (status < 0)
|
||||
{
|
||||
error_printf_silent("Failed to read from socket: %s", strerror(errno));
|
||||
error_printf_silent("Failed to read from socket (%s)", strerror(errno));
|
||||
close(clientfds[i]);
|
||||
clientfds[i] = -1;
|
||||
continue;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue