ecore - handle G_IO_ERR conditions for net sockets

Glib integration with using of select() syscall doesn't properly
propagates G_IO_ERR condition for network sockets. Problem relies in
_ecore_glib_context_poll_to() where rewriting filedescriptor events to
GPollFD structures reside.

This fixes T5725

@fix
This commit is contained in:
Zbigniew Kempczyński 2018-06-17 15:52:48 +09:00 committed by Carsten Haitzler (Rasterman)
parent 4294561c88
commit 1adb73cef8
1 changed files with 17 additions and 0 deletions

View File

@ -4,6 +4,9 @@
#include <stdlib.h>
#include <stdio.h>
#include <sys/socket.h>
#include <netdb.h>
#include <netinet/in.h>
#include "Ecore.h"
#include "ecore_private.h"
@ -111,6 +114,7 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
int ready)
{
GPollFD *itr = pfds, *itr_end = pfds + count;
struct stat st;
for (; (itr < itr_end) && (ready > 0); itr++)
{
@ -124,6 +128,19 @@ _ecore_glib_context_poll_to(GPollFD *pfds,
{
itr->revents |= G_IO_OUT;
ready--;
if (!fstat(itr->fd, &st))
{
if (S_ISSOCK(st.st_mode))
{
struct sockaddr_in peer;
socklen_t length = sizeof(peer);
memset(&peer, 0, sizeof(peer));
if (getpeername(itr->fd, (struct sockaddr *)&peer,
&length))
itr->revents |= G_IO_ERR;
}
}
}
if (FD_ISSET(itr->fd, efds) && (itr->events & (G_IO_HUP | G_IO_ERR)))
{