On Tue, Aug 23, 2016 at 4:27 PM, Jean Guyomarc'h
<jean.guyoma...@openwide.fr> wrote:
[...]
> -   if (efl_net_socket_fd_close_on_exec_get(o))
> -     extra_flags |= SOCK_CLOEXEC;
> -
> -   fd = socket(addr.ss_family, SOCK_STREAM | extra_flags, IPPROTO_TCP);
> +   fd = socket(addr.ss_family, SOCK_STREAM, IPPROTO_TCP);

sorry about the build break, but this is not a good solution for
Linux. There is a race, if some other thread spawns a process now, the
process will inherit fd.

The best solution would be to #ifndef SOCK_CLOEXEC and keep both my
code and your new code. Can you do that?

> -   if (efl_net_server_fd_close_on_exec_get(o))
> -     flags |= SOCK_CLOEXEC;
> -
>     addrlen = sizeof(addr);
> -#ifdef HAVE_ACCEPT4
> -   client = accept4(fd, (struct sockaddr *)&addr, &addrlen, flags);
> -#else
>     client = accept(fd, (struct sockaddr *)&addr, &addrlen);
> -#endif

likewise, here we could leak the fd. That's why accept4() was introduced.


> -   fd = socket(addr.ss_family, SOCK_STREAM | extra_flags, IPPROTO_TCP);
> +   fd = socket(addr.ss_family, SOCK_STREAM, IPPROTO_TCP);

same here.

BTW, is there some build bot with such results or somewhere I could
test MacOS to avoid breaking it?


-- 
Gustavo Sverzut Barbieri
--------------------------------------
Mobile: +55 (16) 99354-9890

------------------------------------------------------------------------------
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to