Set blocking mode to fd returned by accept

That addresses issues in OpenBSD where the fd is
set to non blocking when the accept's fd is non blocking.
This commit is contained in:
Nikos Mavrogiannopoulos
2015-02-14 11:49:26 +01:00
parent ff5c721d30
commit 1b9fe50628
3 changed files with 13 additions and 0 deletions
+4
View File
@@ -1111,6 +1111,10 @@ int main(int argc, char** argv)
continue;
}
set_cloexec_flag (fd, 1);
#ifndef __linux__
/* OpenBSD sets the non-blocking flag if accept's fd is non-blocking */
set_block(fd);
#endif
if (s->config->max_clients > 0 && s->active_clients >= s->config->max_clients) {
close(fd);