Okay in this case because we know the whole thing, but if this went in a
lib it would be racy and allows fds to leak to child processes.

On Monday, July 9, 2012, Enlightenment SVN wrote:

> Log:
> use extra fcntl() instead of accept4 for portability.
>
>
>
> Author:       raster
> Date:         2012-07-09 19:35:00 -0700 (Mon, 09 Jul 2012)
> New Revision: 73509
> Trac:         http://trac.enlightenment.org/e/changeset/73509
>
> Modified:
>   trunk/evas/src/bin/evas_cserve2_main_loop_linux.c
>
> Modified: trunk/evas/src/bin/evas_cserve2_main_loop_linux.c
> ===================================================================
> --- trunk/evas/src/bin/evas_cserve2_main_loop_linux.c   2012-07-09
> 19:52:58 UTC (rev 73508)
> +++ trunk/evas/src/bin/evas_cserve2_main_loop_linux.c   2012-07-10
> 02:35:00 UTC (rev 73509)
> @@ -16,6 +16,7 @@
>  #include <sys/wait.h>
>  #include <signal.h>
>  #include <unistd.h>
> +#include <fcntl.h>
>
>  #define MAX_EPOLL_EVENTS 10
>  #define MAX_INCOMING_CONN 10
> @@ -186,12 +187,13 @@
>     int s;
>
>     len = sizeof(struct sockaddr_un);
> -   s = accept4(socket_fd, &remote, &len, SOCK_CLOEXEC);
> +   s = accept(socket_fd, &remote, &len);
>     if (s == -1)
>       {
>          ERR("Could not accept socket: \"%s\"", strerror(errno));
>          return;
>       }
> +   fcntl(s, F_SETFD, FD_CLOEXEC);
>
>     cserve2_client_accept(s);
>  }
>
>
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> enlightenment-svn mailing list
> [email protected] <javascript:;>
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>


-- 
Gustavo Sverzut Barbieri
http://profusion.mobi embedded systems
--------------------------------------
MSN: [email protected]
Skype: gsbarbieri
Mobile: +55 (19) 9225-2202
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to