aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 14:47:13 (GMT)
committerGustavo Sverzut Barbieri <barbieri@profusion.mobi>2016-12-19 15:03:33 (GMT)
commitb4c80b50bcef841d853f7e884b3eb921466096f3 (patch)
treeab71deb94cc351d6eaa5349886d34bdfa7781e65
parentecore_con/ecore_ipc legacy: fail early for local sockets. (diff)
downloadefl-b4c80b50bcef841d853f7e884b3eb921466096f3.tar.gz
efl_net_socket_fd: initialize fds to INVALID_SOCKET
Since 0 is a valid fd, then we'd try to do socket operations on it, which would generate misleading errors.
-rw-r--r--src/lib/ecore_con/efl_net_socket_fd.c6
1 files changed, 5 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 ec0134f..6902c87 100644
--- a/src/lib/ecore_con/efl_net_socket_fd.c
+++ b/src/lib/ecore_con/efl_net_socket_fd.c
@@ -79,6 +79,9 @@ _efl_net_socket_fd_efl_object_constructor(Eo *o, Efl_Net_Socket_Fd_Data *pd)
efl_io_closer_close_on_exec_set(o, EINA_TRUE);
efl_io_closer_close_on_destructor_set(o, EINA_TRUE);
+ efl_io_reader_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
+ efl_io_writer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
+ efl_io_closer_fd_set(o, SOCKET_TO_LOOP_FD(INVALID_SOCKET));
return o;
}
@@ -175,8 +178,9 @@ _efl_net_socket_fd_efl_io_closer_close(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UN
}
EOLIAN static Eina_Bool
-_efl_net_socket_fd_efl_io_closer_closed_get(Eo *o, Efl_Net_Socket_Fd_Data *pd EINA_UNUSED)
+_efl_net_socket_fd_efl_io_closer_closed_get(Eo *o, Efl_Net_Socket_Fd_Data *pd)
{
+ if (pd->family == AF_UNSPEC) return EINA_FALSE;
return (SOCKET)efl_io_closer_fd_get(o) == INVALID_SOCKET;
}