summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorCedric BAIL <cedric.bail@free.fr>2010-12-16 13:16:40 +0000
committerCedric BAIL <cedric.bail@free.fr>2010-12-16 13:16:40 +0000
commitae9917c9f2f612e60e999a199a5935a4a2876834 (patch)
tree7fce9e3d86786a3ed0a8cc02e635262475f20f85 /legacy
parent8a4ad8c102d241417b8b86589f25f9e02ee0bffe (diff)
* ecore: SPANK ! SPANK ! SPANK !
The value of errno is only know when the result of a syscall tell you to look at it. And don't set errno, that's a bad idea ! SVN revision: 55594
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_con/ecore_con.c15
1 files changed, 5 insertions, 10 deletions
diff --git a/legacy/ecore/src/lib/ecore_con/ecore_con.c b/legacy/ecore/src/lib/ecore_con/ecore_con.c
index 8e1cfb416d..976fef6747 100644
--- a/legacy/ecore/src/lib/ecore_con/ecore_con.c
+++ b/legacy/ecore/src/lib/ecore_con/ecore_con.c
@@ -1610,7 +1610,6 @@ svr_try_connect_plain(Ecore_Con_Server *svr)
1610 int so_err = 0; 1610 int so_err = 0;
1611 unsigned int size = sizeof(int); 1611 unsigned int size = sizeof(int);
1612 1612
1613 errno = 0;
1614 res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size); 1613 res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err, &size);
1615#ifdef _WIN32 1614#ifdef _WIN32
1616 if (res == SOCKET_ERROR) 1615 if (res == SOCKET_ERROR)
@@ -1801,9 +1800,8 @@ _ecore_con_cl_read(Ecore_Con_Server *svr)
1801 1800
1802 if (!(svr->type & ECORE_CON_SSL)) 1801 if (!(svr->type & ECORE_CON_SSL))
1803 { 1802 {
1804 errno = 0;
1805 num = read(svr->fd, buf, sizeof(buf)); 1803 num = read(svr->fd, buf, sizeof(buf));
1806 if ((num > 0) || (errno == EAGAIN)) 1804 if ((num >= 0) || (errno == EAGAIN))
1807 lost_server = EINA_FALSE; 1805 lost_server = EINA_FALSE;
1808 } 1806 }
1809 else 1807 else
@@ -1935,10 +1933,9 @@ _ecore_con_cl_udp_handler(void *data,
1935 return ECORE_CALLBACK_RENEW; 1933 return ECORE_CALLBACK_RENEW;
1936 } 1934 }
1937 1935
1938 errno = 0;
1939 num = read(svr->fd, buf, READBUFSIZ); 1936 num = read(svr->fd, buf, READBUFSIZ);
1940 1937
1941 if ((!svr->delete_me) && (num > 0)) 1938 if ((!svr->delete_me) && (num >= 0))
1942 { 1939 {
1943 inbuf = malloc(num); 1940 inbuf = malloc(num);
1944 EINA_SAFETY_ON_NULL_RETURN_VAL(inbuf, ECORE_CALLBACK_RENEW); 1941 EINA_SAFETY_ON_NULL_RETURN_VAL(inbuf, ECORE_CALLBACK_RENEW);
@@ -1956,7 +1953,7 @@ _ecore_con_cl_udp_handler(void *data,
1956 _ecore_con_event_server_data_free, NULL); 1953 _ecore_con_event_server_data_free, NULL);
1957 } 1954 }
1958 1955
1959 if ((errno != EAGAIN) && (errno != EINTR)) 1956 if (num < 0 && (errno != EAGAIN) && (errno != EINTR))
1960 _ecore_con_server_kill(svr); 1957 _ecore_con_server_kill(svr);
1961 1958
1962 return ECORE_CALLBACK_RENEW; 1959 return ECORE_CALLBACK_RENEW;
@@ -1987,7 +1984,6 @@ _ecore_con_svr_udp_handler(void *data,
1987 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ)) 1984 if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
1988 return ECORE_CALLBACK_RENEW; 1985 return ECORE_CALLBACK_RENEW;
1989 1986
1990 errno = 0;
1991#ifdef _WIN32 1987#ifdef _WIN32
1992 num = fcntl(svr->fd, F_SETFL, O_NONBLOCK); 1988 num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
1993 if (num >= 0) 1989 if (num >= 0)
@@ -2001,7 +1997,7 @@ _ecore_con_svr_udp_handler(void *data,
2001 &client_addr_len); 1997 &client_addr_len);
2002#endif 1998#endif
2003 1999
2004 if ((errno != EAGAIN) && (errno != EINTR)) 2000 if (num < 0 && (errno != EAGAIN) && (errno != EINTR))
2005 { 2001 {
2006 if (!svr->delete_me) 2002 if (!svr->delete_me)
2007 { 2003 {
@@ -2102,9 +2098,8 @@ _ecore_con_svr_cl_read(Ecore_Con_Client *cl)
2102 2098
2103 if (!(cl->host_server->type & ECORE_CON_SSL)) 2099 if (!(cl->host_server->type & ECORE_CON_SSL))
2104 { 2100 {
2105 errno = 0;
2106 num = read(cl->fd, buf, sizeof(buf)); 2101 num = read(cl->fd, buf, sizeof(buf));
2107 if ((num > 0) || (errno == EAGAIN) || (errno == EINTR)) 2102 if ((num >= 0) || (errno == EAGAIN) || (errno == EINTR))
2108 lost_client = EINA_FALSE; 2103 lost_client = EINA_FALSE;
2109 } 2104 }
2110 else 2105 else