use extra fcntl() instead of accept4 for portability.

SVN revision: 73509
This commit is contained in:
Carsten Haitzler 2012-07-10 02:35:00 +00:00
parent f529ecfa32
commit 9d4a352a45
1 changed files with 3 additions and 1 deletions

View File

@ -16,6 +16,7 @@
#include <sys/wait.h> #include <sys/wait.h>
#include <signal.h> #include <signal.h>
#include <unistd.h> #include <unistd.h>
#include <fcntl.h>
#define MAX_EPOLL_EVENTS 10 #define MAX_EPOLL_EVENTS 10
#define MAX_INCOMING_CONN 10 #define MAX_INCOMING_CONN 10
@ -186,12 +187,13 @@ _socketfd_handler(int fd __UNUSED__, Fd_Flags flags __UNUSED__, void *data __UNU
int s; int s;
len = sizeof(struct sockaddr_un); len = sizeof(struct sockaddr_un);
s = accept4(socket_fd, &remote, &len, SOCK_CLOEXEC); s = accept(socket_fd, &remote, &len);
if (s == -1) if (s == -1)
{ {
ERR("Could not accept socket: \"%s\"", strerror(errno)); ERR("Could not accept socket: \"%s\"", strerror(errno));
return; return;
} }
fcntl(s, F_SETFD, FD_CLOEXEC);
cserve2_client_accept(s); cserve2_client_accept(s);
} }