On 12/16/2010 02:16 PM, Enlightenment SVN wrote:
> Log:
>       * 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 !
>
>
> Author:       cedric
> Date:         2010-12-16 05:16:40 -0800 (Thu, 16 Dec 2010)
> New Revision: 55594
> Trac:         http://trac.enlightenment.org/e/changeset/55594
>
> Modified:
>    trunk/ecore/src/lib/ecore_con/ecore_con.c
>
> Modified: trunk/ecore/src/lib/ecore_con/ecore_con.c
> ===================================================================
> --- trunk/ecore/src/lib/ecore_con/ecore_con.c 2010-12-16 13:08:49 UTC (rev 
> 55593)
> +++ trunk/ecore/src/lib/ecore_con/ecore_con.c 2010-12-16 13:16:40 UTC (rev 
> 55594)
> @@ -1610,7 +1610,6 @@
>      int so_err = 0;
>      unsigned int size = sizeof(int);
>
> -   errno = 0;
>      res = getsockopt(svr->fd, SOL_SOCKET, SO_ERROR, (void *)&so_err,&size);
>   #ifdef _WIN32
>      if (res == SOCKET_ERROR)
> @@ -1801,9 +1800,8 @@
>
>      if (!(svr->type&  ECORE_CON_SSL))
>        {
> -        errno = 0;
>           num = read(svr->fd, buf, sizeof(buf));
> -        if ((num>  0) || (errno == EAGAIN))
> +        if ((num>= 0) || (errno == EAGAIN))
>             lost_server = EINA_FALSE;

Sure this is right? a ret 0 an errno != EAGAIN is probably a lost server.

>        }
>      else
> @@ -1935,10 +1933,9 @@
>           return ECORE_CALLBACK_RENEW;
>        }
>
> -   errno = 0;
>      num = read(svr->fd, buf, READBUFSIZ);
>
> -   if ((!svr->delete_me)&&  (num>  0))
> +   if ((!svr->delete_me)&&  (num>= 0))
>        {
>           inbuf = malloc(num);

malloc(0) is nosense, and will return in the safety check.


>           EINA_SAFETY_ON_NULL_RETURN_VAL(inbuf, ECORE_CALLBACK_RENEW);
> @@ -1956,7 +1953,7 @@
>                           _ecore_con_event_server_data_free, NULL);
>        }
>
> -   if ((errno != EAGAIN)&&  (errno != EINTR))
> +   if (num<  0&&  (errno != EAGAIN)&&  (errno != EINTR))
>        _ecore_con_server_kill(svr);
>
>      return ECORE_CALLBACK_RENEW;
> @@ -1987,7 +1984,6 @@
>      if (!ecore_main_fd_handler_active_get(fd_handler, ECORE_FD_READ))
>        return ECORE_CALLBACK_RENEW;
>
> -   errno = 0;
>   #ifdef _WIN32
>      num = fcntl(svr->fd, F_SETFL, O_NONBLOCK);
>      if (num>= 0)
> @@ -2001,7 +1997,7 @@
>                 &client_addr_len);
>   #endif
>
> -   if ((errno != EAGAIN)&&  (errno != EINTR))
> +   if (num<  0&&  (errno != EAGAIN)&&  (errno != EINTR))
>        {
>           if (!svr->delete_me)
>             {
> @@ -2102,9 +2098,8 @@
>
>      if (!(cl->host_server->type&  ECORE_CON_SSL))
>        {
> -        errno = 0;
>           num = read(cl->fd, buf, sizeof(buf));
> -        if ((num>  0) || (errno == EAGAIN) || (errno == EINTR))
> +        if ((num>= 0) || (errno == EAGAIN) || (errno == EINTR))
>             lost_client = EINA_FALSE;
>        }
>      else
>

S.

------------------------------------------------------------------------------
Lotusphere 2011
Register now for Lotusphere 2011 and learn how
to connect the dots, take your collaborative environment
to the next level, and enter the era of Social Business.
http://p.sf.net/sfu/lotusphere-d2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to