WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

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

To: Jeremy Katz <katzj@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH] Check some returns of common functions
From: Ewan Mellor <ewan@xxxxxxxxxxxxx>
Date: Wed, 26 Apr 2006 09:29:13 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Wed, 26 Apr 2006 01:29:34 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <1146017884.3007.13.camel@xxxxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <1146017884.3007.13.camel@xxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: Mutt/1.5.9i
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