On Mon, 9 Jul 2012 23:54:46 -0300 Gustavo Sverzut Barbieri <[email protected]> said:
> 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. actually it'd only be racy *IF* u have the ability to call back to app between accept() and fcntl() so it might fork a child in that time *OR* if this was run from a thread and then u have a race with the mainloop forking at the exact time between accept and fcntl. that's it. :) one of the good reasons to be very careful about how we support threaded usage and support. > 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 > -- ------------- Codito, ergo sum - "I code, therefore I am" -------------- The Rasterman (Carsten Haitzler) [email protected] ------------------------------------------------------------------------------ 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
