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] libxl build errors in xen-unstable

To: Olaf Hering <olaf@xxxxxxxxx>
Subject: Re: [Xen-devel] libxl build errors in xen-unstable
From: Ian Campbell <Ian.Campbell@xxxxxxxxxx>
Date: Tue, 31 May 2011 10:44:56 +0100
Cc: "xen-devel@xxxxxxxxxxxxxxxxxxx" <xen-devel@xxxxxxxxxxxxxxxxxxx>
Delivery-date: Tue, 31 May 2011 07:39:44 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <1306831543.775.119.camel@xxxxxxxxxxxxxxxxxxxxxx>
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>
Organization: Citrix Systems, Inc.
References: <20110530163326.GA24266@xxxxxxxxx> <1306831543.775.119.camel@xxxxxxxxxxxxxxxxxxxxxx>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
On Tue, 2011-05-31 at 09:45 +0100, Ian Campbell wrote:
> 
> [...]
> > libxl_exec.c:48: error: ignoring return value of 'atoi', declared
> with attribute warn_unused_result
> [...]
> > libxl_exec.c:224: error: ignoring return value of 'write', declared
> with attribute warn_unused_result
> [...]
> > libxl_device.c:488: error: ignoring return value of 'read', declared
> with attribute warn_unused_result
> 
> Has someone got a bit carried away with the warn_unused_result
> attribute in your distro/gcc/libc/etc? Applying that sort of attribute
> system wide to such widespread functions seems like... trouble...

Are you running Ubuntu by any chance?
https://wiki.ubuntu.com/CompilerFlags

Does this help?

Ian.


# HG changeset patch
# User Ian Campbell <ian.campbell@xxxxxxxxxx>
# Date 1306835068 -3600
# Node ID 94be5a2d500c19b8e1ee8fc18374d70cdfdb0f0f
# Parent  8cf4450955f43bb6e5fc07f20cacdf6e8cb80765
libxl: check return values of read/write

Some distros enable -D_FORTIFY_SOURCE=2 by default
(https://wiki.ubuntu.com/CompilerFlags) which adds the warn_unused_result
attribute to several functions including read(2) and write(2)

Although we don't really care about error reading or writing the libxl spawn fd
catch them anyway to keep this warning happy.

Signed-off-by: Ian Campbell <ian.campbell@xxxxxxxxxx>

diff -r 8cf4450955f4 -r 94be5a2d500c tools/libxl/libxl_device.c
--- a/tools/libxl/libxl_device.c        Tue May 31 09:47:56 2011 +0100
+++ b/tools/libxl/libxl_device.c        Tue May 31 10:44:28 2011 +0100
@@ -485,7 +485,9 @@ again:
             }
             if (starting && FD_ISSET(starting->for_spawn->fd, &rfds)) {
                 unsigned char dummy;
-                read(starting->for_spawn->fd, &dummy, sizeof(dummy));
+                if (read(starting->for_spawn->fd, &dummy, sizeof(dummy)) != 1)
+                    LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_DEBUG,
+                                     "failed to read spawn status pipe");
             }
         }
     }
diff -r 8cf4450955f4 -r 94be5a2d500c tools/libxl/libxl_exec.c
--- a/tools/libxl/libxl_exec.c  Tue May 31 09:47:56 2011 +0100
+++ b/tools/libxl/libxl_exec.c  Tue May 31 10:44:28 2011 +0100
@@ -220,8 +220,10 @@ int libxl__spawn_spawn(libxl__gc *gc,
     rc = (WIFEXITED(status) ? WEXITSTATUS(status) :
           WIFSIGNALED(status) && WTERMSIG(status) < 127
           ? WTERMSIG(status)+128 : -1);
-    if (for_spawn)
-        write(pipes[1], &dummy, sizeof(dummy));
+    if (for_spawn) {
+        if (write(pipes[1], &dummy, sizeof(dummy)) != 1)
+            perror("libxl__spawn_spawn: unable to signal child exit to 
parent");
+    }
     _exit(rc);
 
  err_parent_pipes:



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