From mboxrd@z Thu Jan 1 00:00:00 1970 From: Olaf Hering Subject: [PATCH 03 of 45] gcc-4.6 compile fix: tools/xenstore/xenstored_core.c Date: Thu, 19 May 2011 21:05:22 +0200 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org # HG changeset patch # User Olaf Hering # 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] Signed-off-by: Olaf Hering 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; + } }