summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--econserv.c5
-rw-r--r--util.c8
2 files changed, 5 insertions, 8 deletions
diff --git a/econserv.c b/econserv.c
index 89d3ea9..f3f990e 100644
--- a/econserv.c
+++ b/econserv.c
@@ -27,7 +27,6 @@
#include <stddef.h>
#include <stdint.h>
#include <assert.h>
-#include <errno.h>
#include <sys/types.h>
#include <sys/socket.h>
@@ -212,7 +211,7 @@ handle_input(struct ecs *ecs, char *in, int fd,
in.sin_addr.s_addr = ((struct sockaddr_in *) src_addr)->sin_addr.s_addr;
printf("got connect request\n");
if (connect(ecs->client_fd, (struct sockaddr *) &in, sizeof in) != 0) {
- fprintf(stderr, "failed to connect: %s\n", strerror(errno));
+ perror("Failed to connect");
close(ecs->client_fd);
ecs->client_fd = -1;
ecs->state = E_PSTAT_NOUSE;
@@ -347,7 +346,7 @@ int main(int argc, char *argv[])
}
if (select(maxfd + 1, &fds, NULL, NULL, NULL) <= 0) {
- fprintf(stderr, "select failed: %s", strerror(errno));
+ perror("Select failed");
continue;
}
diff --git a/util.c b/util.c
index 4df5080..ab04d08 100644
--- a/util.c
+++ b/util.c
@@ -59,8 +59,7 @@ sock_get_ifreq(int fd)
ifconf.ifc_len = sizeof ifreqs;
ifconf.ifc_req = ifreqs;
if (ioctl(fd, SIOCGIFCONF, &ifconf) < 0) {
- fprintf(stderr, "retrieving interfaces failed: %s\n",
- strerror(errno));
+ perror("Reading interface configuration failed");
return NULL;
}
@@ -203,8 +202,7 @@ connect_to_host(int socktype, const char *host, const char *port)
int broadcast_enable = 1;
if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST,
&broadcast_enable, sizeof(broadcast_enable)) < 0)
- fprintf(stderr, "Failed to setsockopt broadcast: %s\n",
- strerror(errno));
+ perror("Failed to setsockopt broadcast");
}
if (connect(fd, rp->ai_addr, rp->ai_addrlen) != -1)
@@ -214,7 +212,7 @@ connect_to_host(int socktype, const char *host, const char *port)
}
freeaddrinfo(result);
if (rp == NULL) {
- fprintf(stderr, "Failed to connect: %s\n", strerror(errno));
+ perror("Failed to connect");
return -1;
}