commit 3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8 from: Omar Polo date: Fri Feb 12 11:59:03 2021 UTC 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. commit - 9356f61a63d2d50194884ada28a9f3164fdd00f4 commit + 3cb3dd4d422cdead2dd09f1e3ce3eff35a9e6dc8 blob - 69ed05386571248590401f64ac197b3e9614e381 blob + 9baec82cc53c0a2ae54f60e6d4bd5a0c40607167 --- sandbox.c +++ sandbox.c @@ -153,6 +153,7 @@ sandbox() #endif SC_ALLOW(epoll_pwait), SC_ALLOW(epoll_ctl), + SC_ALLOW(accept), SC_ALLOW(accept4), SC_ALLOW(read), SC_ALLOW(openat), blob - c6f83b83de3c637b8ae250b522f4220590c8eaa9 blob + 777815ebc046d1d6f387c30627e15d8c6f3574ea --- server.c +++ 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) {