diff options
author | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-08 18:54:43 -0200 |
---|---|---|
committer | Gustavo Sverzut Barbieri <barbieri@profusion.mobi> | 2016-12-09 13:47:03 -0200 |
commit | 3fc0fbba42eaf331f69dbad0c507c1bf3d0cfc94 (patch) | |
tree | 611c0947338f7dcf8a4de253bba33969608016ac | |
parent | cfc21c16fb0151bafea41f68a9f4a95248018408 (diff) | |
download | efl-3fc0fbba42eaf331f69dbad0c507c1bf3d0cfc94.tar.gz |
efl_net_socket_fd: do not close stdout if nothing was set.
if we create an object, say a TCP dialer, and don't connect/bind, then
we have no FD (=0). If we set FD to INVALID_SOCKET on start, other
parts of the code will fail since they consider that "closed", but
we're not closed yet.
Then check for family == AF_UNSPEC && fd == 0, if so don't close it.
-rw-r--r-- | src/lib/ecore_con/efl_net_socket_fd.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/ecore_con/efl_net_socket_fd.c b/src/lib/ecore_con/efl_net_socket_fd.c index 4bed00dd17..ec0134f0b6 100644 --- a/src/lib/ecore_con/efl_net_socket_fd.c +++ b/src/lib/ecore_con/efl_net_socket_fd.c @@ -164,7 +164,8 @@ _efl_net_socket_fd_efl_io_closer_close(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UN efl_loop_fd_set(efl_super(o, MY_CLASS), SOCKET_TO_LOOP_FD(INVALID_SOCKET)); efl_io_closer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET)); - if (closesocket(fd) != 0) ret = efl_net_socket_error_get(); + if (!((pd->family == AF_UNSPEC) && (fd == 0))) /* if nothing is set, fds are all zero, avoid closing STDOUT */ + if (closesocket(fd) != 0) ret = efl_net_socket_error_get(); efl_event_callback_call(o, EFL_IO_CLOSER_EVENT_CLOSED, NULL); /* do the cleanup our _efl_net_socket_fd_efl_loop_fd_fd_set() would do */ |