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 03 of 45] gcc-4.6 compile fix: tools/xenstore/xen

To: Olaf Hering <olaf@xxxxxxxxx>, <xen-devel@xxxxxxxxxxxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 03 of 45] gcc-4.6 compile fix: tools/xenstore/xenstored_core.c
From: Keir Fraser <keir@xxxxxxx>
Date: Fri, 20 May 2011 09:21:23 +0100
Cc:
Delivery-date: Fri, 20 May 2011 01:22:26 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:sender:user-agent:date:subject:from:to :message-id:thread-topic:thread-index:in-reply-to:mime-version :content-type:content-transfer-encoding; bh=eFCEzZWSWJOwIIVJO4g8neCUXp4HGexKYjn3IEau8wA=; b=bKm/3qMw2EeicbJv1hE6SkiTm1z7S2YiPNAQHCLZlxXtStHVPzvFu5jWM7fozdhwSS X/iUv841KzTSZ6zXX4besKm5vk/1wfvrR+V28dbLTTiAfrg+1VbCvzwmlU+l9R8ISMzi q/Lutwr4WfekZCPVQOj9k988/ig8j5FDyC6jI=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=sender:user-agent:date:subject:from:to:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=QEuywbkFZe4yldofM/jm60Z4GS8U+lYqTpSIq74ZzR0XrARUZ/91rjYxTIyv7OnX3L VRSPGUlZFleNFKh/EA4BIrG2ktEL0/ye4vCYFirwz3rOclS96gvkAZGjik2jqREkdpZi tgEoBXsovp8MIQ+ITMehCPI9OtG7xaGqH5hM0=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <cb0ed92e451d06789cb1.1305831922@xxxxxxxxxxxx>
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/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcwWxud9KHeQFNX5n0eUjvNrHd4ZPQ==
Thread-topic: [Xen-devel] [PATCH 03 of 45] gcc-4.6 compile fix: tools/xenstore/xenstored_core.c
User-agent: Microsoft-Entourage/12.29.0.110113
On 19/05/2011 20:05, "Olaf Hering" <olaf@xxxxxxxxx> wrote:

> # HG changeset patch
> # User Olaf Hering <olaf@xxxxxxxxx>
> # Date 1305824384 -7200
> # Node ID cb0ed92e451d06789cb1a0ba14967bda3a7a5bcb
> # Parent  9c492ce99bbe24e1b4bbe43c754f136ac19a372f
> gcc-4.6 compile fix: tools/xenstore/xenstored_core.c
> 
> xenstored_core.c: In function 'trace':
> xenstored_core.c:133:11: error: variable 'dummy' set but not used
> [-Werror=unused-but-set-variable]
> xenstored_core.c: In function 'trigger_reopen_log':
> xenstored_core.c:203:6: error: variable 'dummy' set but not used
> [-Werror=unused-but-set-variable]

I applied the first couple of these patches, but... We don't set
-Werror=unused-but-set-variable, so we don't actually need these fixes, do
we? Unless they are cleanups or fixes in some other way?

 -- Keir

> Signed-off-by: Olaf Hering <olaf@xxxxxxxxx>
> 
> diff -r 9c492ce99bbe -r cb0ed92e451d tools/xenstore/xenstored_core.c
> --- a/tools/xenstore/xenstored_core.c Thu May 19 18:59:42 2011 +0200
> +++ b/tools/xenstore/xenstored_core.c Thu May 19 18:59:44 2011 +0200
> @@ -130,7 +130,7 @@ void trace(const char *fmt, ...)
> va_list arglist;
> char *str;
> char sbuf[1024];
> - int ret, dummy;
> + int ret;
>  
> if (tracefd < 0)
> return;
> @@ -141,7 +141,10 @@ void trace(const char *fmt, ...)
> va_end(arglist);
>  
> if (ret <= 1024) {
> -  dummy = write(tracefd, sbuf, ret);
> +  if (write(tracefd, sbuf, ret) < 0) {
> +   close(tracefd);
> +   tracefd = -1;
> +  }
> return;
> }
>  
> @@ -149,7 +152,10 @@ void trace(const char *fmt, ...)
> va_start(arglist, fmt);
> str = talloc_vasprintf(NULL, fmt, arglist);
> va_end(arglist);
> - dummy = write(tracefd, str, strlen(str));
> + if (write(tracefd, str, strlen(str)) < 0) {
> +  close(tracefd);
> +  tracefd = -1;
> + }
> talloc_free(str);
>  }
>  
> @@ -200,8 +206,12 @@ void trace_destroy(const void *data, con
>  static void trigger_reopen_log(int signal __attribute__((unused)))
>  {
> char c = 'A';
> - int dummy;
> - dummy = write(reopen_log_pipe[1], &c, 1);
> + if (reopen_log_pipe[1] < 0)
> +  return;
> + if (write(reopen_log_pipe[1], &c, 1) < 0) {
> +  close(reopen_log_pipe[1]);
> +  reopen_log_pipe[1] = -1;
> + }
>  }
>  
>  
> 
> _______________________________________________
> Xen-devel mailing list
> Xen-devel@xxxxxxxxxxxxxxxxxxx
> http://lists.xensource.com/xen-devel



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