[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH] Check some returns of common functions



On Tue, Apr 25, 2006 at 10:18:04PM -0400, Jeremy Katz wrote:

> When building with FORTIFY_SOURCE to ensure that return codes of common
> functions are checked to avoid some bugs, a few warnings pop up and
> become errors due to -Werror.  Attached checks the return codes
> 
> Signed-off-by: Jeremy Katz <katzj@xxxxxxxxxx>

> --- xen-unstable.hg/tools/xenstore/xenstored_core.c.unused    2006-04-25 
> 22:06:11.000000000 -0400
> +++ xen-unstable.hg/tools/xenstore/xenstored_core.c   2006-04-25 
> 22:11:22.000000000 -0400
> @@ -173,7 +173,7 @@
>       va_list arglist;
>       char *str;
>       char sbuf[1024];
> -     int ret;
> +     int ret, dummy;
>  
>       if (tracefd < 0)
>               return;
> @@ -184,7 +184,7 @@
>       va_end(arglist);
>  
>       if (ret <= 1024) {
> -             write(tracefd, sbuf, ret);
> +             dummy = write(tracefd, sbuf, ret);
>               return;


Does (void)write(tracefd, sbuf, ref) not work?  This ought to make it clear
that the return value is being ignored without additional dummy variables.

Ewan.

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.