On Fri, Dec 17, 2010 at 9:44 AM, Enlightenment SVN
<no-re...@enlightenment.org> wrote:
> Log:
> don't accept 0 return

You should not look at errno in the case of num == 0. It's not
defined. When read == 0, that means that the connection is now closed
and next read will return < 0. But read == 0 is not an error case and
errno is not defined in that case.

> Author:       englebass
> Date:         2010-12-17 00:44:53 -0800 (Fri, 17 Dec 2010)
> New Revision: 55604
> Trac:         http://trac.enlightenment.org/e/changeset/55604
>
> 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-17 08:39:21 UTC (rev 
> 55603)
> +++ trunk/ecore/src/lib/ecore_con/ecore_con.c   2010-12-17 08:44:53 UTC (rev 
> 55604)
> @@ -1801,7 +1801,8 @@
>    if (!(svr->type & ECORE_CON_SSL))
>      {
>         num = read(svr->fd, buf, sizeof(buf));
> -        if ((num >= 0) || (errno == EAGAIN))
> +        /* 0 is not a valid return value for a tcp socket */
> +        if ((num > 0) || (errno == EAGAIN))
>           lost_server = EINA_FALSE;
>      }
>    else
> @@ -2099,7 +2100,8 @@
>    if (!(cl->host_server->type & ECORE_CON_SSL))
>      {
>         num = read(cl->fd, buf, sizeof(buf));
> -        if ((num >= 0) || (errno == EAGAIN) || (errno == EINTR))
> +        /* 0 is not a valid return value for a tcp socket */
> +        if ((num > 0) || (errno == EAGAIN) || (errno == EINTR))
>           lost_client = EINA_FALSE;
>      }
>    else
>
>
> ------------------------------------------------------------------------------
> 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-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>



-- 
Cedric BAIL

------------------------------------------------------------------------------
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
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to