aboutsummaryrefslogtreecommitdiff
path: root/server.c
diff options
context:
space:
mode:
authorOmar Polo <op@omarpolo.com>2021-02-12 11:59:03 +0000
committerOmar Polo <op@omarpolo.com>2021-02-12 11:59:03 +0000
commit3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8 (patch)
tree265c69c94956917b1a6f0301ef721d8ffbf1e493 /server.c
parent9356f61a63d2d50194884ada28a9f3164fdd00f4 (diff)
accept4 -> accept
accept4(2) isn't part of any standard (even though it'll be part in the future) and raises warnings on some linux distro. Moreover, we don't have thread that may fork at any time, so doing a mark_nonblock after isn't a big deal.
Diffstat (limited to 'server.c')
-rw-r--r--server.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/server.c b/server.c
index c6f83b8..777815e 100644
--- a/server.c
+++ b/server.c
@@ -980,12 +980,14 @@ do_accept(int sock, short et, void *d)
saddr = (struct sockaddr*)&addr;
len = sizeof(addr);
- if ((fd = accept4(sock, saddr, &len, SOCK_NONBLOCK)) == -1) {
+ if ((fd = accept(sock, saddr, &len)) == -1) {
if (errno == EWOULDBLOCK || errno == EAGAIN)
return;
fatal("accept: %s", strerror(errno));
}
+ mark_nonblock(fd);
+
for (i = 0; i < MAX_USERS; ++i) {
c = &s->clients[i];
if (c->fd == -1) {