Commit 3585accf authored by Rémi Denis-Courmont's avatar Rémi Denis-Courmont

Linux: use accept4 if available (glibc 2.10)

parent 303fbc7c
...@@ -583,7 +583,7 @@ AC_CHECK_FUNCS(fdatasync,, ...@@ -583,7 +583,7 @@ AC_CHECK_FUNCS(fdatasync,,
]) ])
dnl Check for non-standard system calls dnl Check for non-standard system calls
AC_CHECK_FUNCS([vmsplice eventfd fstatfs]) AC_CHECK_FUNCS([vmsplice eventfd fstatfs accept4])
AH_BOTTOM([#include <vlc_fixups.h>]) AH_BOTTOM([#include <vlc_fixups.h>])
......
...@@ -2517,6 +2517,10 @@ static void* httpd_HostThread( void *data ) ...@@ -2517,6 +2517,10 @@ static void* httpd_HostThread( void *data )
continue; continue;
/* */ /* */
#ifdef HAVE_ACCEPT4
fd = accept4 (fd, NULL, NULL, SOCK_CLOEXEC);
if (fd == -1 && errno == ENOSYS)
#endif
fd = accept (fd, NULL, NULL); fd = accept (fd, NULL, NULL);
if (fd == -1) if (fd == -1)
continue; continue;
......
...@@ -255,8 +255,15 @@ next_ai: /* failure */ ...@@ -255,8 +255,15 @@ next_ai: /* failure */
int net_AcceptSingle (vlc_object_t *obj, int lfd) int net_AcceptSingle (vlc_object_t *obj, int lfd)
{ {
int fd; int fd;
do do
{
#ifdef HAVE_ACCEPT4
fd = accept4 (lfd, NULL, NULL, SOCK_CLOEXEC);
if (fd == -1 && errno == ENOSYS)
#endif
fd = accept (lfd, NULL, NULL); fd = accept (lfd, NULL, NULL);
}
while (fd == -1 && errno == EINTR); while (fd == -1 && errno == EINTR);
if (fd == -1) if (fd == -1)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment