Set only the client socket in non-blocking mode instead of all fds;
should avoid problems with stdio handles.

diff --git a/server/select.c b/server/select.c
index 645f02a..60a6fd4 100644
--- a/server/select.c
+++ b/server/select.c
@@ -6,7 +6,6 @@
 
 #include <assert.h>
 #include <errno.h>
-#include <fcntl.h>
 #include <signal.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -37,12 +36,8 @@
 /* register a user */
 void register_select_user( struct select_user *user )
 {
-    int flags;
     assert( !users[user->fd] );
 
-    flags = fcntl( user->fd, F_GETFL, 0 );
-    fcntl( user->fd, F_SETFL, flags | O_NONBLOCK );
-
     users[user->fd] = user;
     if (user->fd > max_fd) max_fd = user->fd;
     nb_users++;
diff --git a/server/socket.c b/server/socket.c
index 98c1f6d..915de42 100644
--- a/server/socket.c
+++ b/server/socket.c
@@ -6,6 +6,7 @@
 
 #include <assert.h>
 #include <errno.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdlib.h>
 #include <stdarg.h>
@@ -287,9 +288,13 @@
 /* add a client */
 struct client *add_client( int fd, struct thread *self )
 {
+    int flags;
     struct client *client = mem_alloc( sizeof(*client) );
     if (!client) return NULL;
 
+    flags = fcntl( fd, F_GETFL, 0 );
+    fcntl( fd, F_SETFL, flags | O_NONBLOCK );
+
     client->state                = RUNNING;
     client->select.fd            = fd;
     client->select.func          = client_event;