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

[Xen-devel] [PATCH] Fix the build of blktap

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-devel] [PATCH] Fix the build of blktap
From: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>
Date: Mon, 09 Mar 2009 18:31:25 +0900
Delivery-date: Mon, 09 Mar 2009 02:32:27 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
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
User-agent: Thunderbird 2.0.0.19 (Windows/20081209)
This patch fixes the following compilation error introduced by the recent change
in block-qcow2.c. 

-----------------------------------------------
gcc  -O1 -fno-omit-frame-pointer -fno-optimize-sibling-calls -m64 -g 
-fno-strict-aliasing -std=gnu99 -Wall -Wstrict-prototypes -Wno-unused-value 
-Wdeclaration-after-statement  -D__XEN_TOOLS__ -MMD -MF .block-qcow2.o.d  
-D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE  -Werror -Wno-unused -I../lib 
-I../../../tools/libxc -I../../../tools/include -I../../../tools/xenstore 
-I../../../tools/include -I ../../libaio/src -D_GNU_SOURCE -c -o block-qcow2.o 
block-qcow2.c
cc1: warnings being treated as errors
block-qcow2.c: In function 'qcow2_create':
block-qcow2.c:2045: error: ignoring return value of 'write', declared with 
attribute warn_unused_result
block-qcow2.c:2047: error: ignoring return value of 'write', declared with 
attribute warn_unused_result
block-qcow2.c:2052: error: ignoring return value of 'write', declared with 
attribute warn_unused_result
block-qcow2.c:2055: error: ignoring return value of 'write', declared with 
attribute warn_unused_result
block-qcow2.c:2058: error: ignoring return value of 'write', declared with 
attribute warn_unused_result
make[5]: *** [block-qcow2.o] Error 1
---------------------------------------------

Signed-off-by: Yosuke Iwamatsu <y-iwamatsu@xxxxxxxxxxxxx>

diff -r 7f573cb76db4 tools/blktap/drivers/block-qcow2.c
--- a/tools/blktap/drivers/block-qcow2.c        Tue Mar 03 13:22:28 2009 +0000
+++ b/tools/blktap/drivers/block-qcow2.c        Thu Mar 05 11:20:41 2009 +0900
@@ -1984,6 +1984,7 @@
                       const char *backing_file, int flags)
 {
     int fd, header_size, backing_filename_len, l1_size, i, shift, l2_bits;
+    int ret = 0;
     QCowHeader header;
     uint64_t tmp, offset;
     QCowCreateState s1, *s = &s1;
@@ -2042,25 +2043,37 @@
     create_refcount_update(s, s->refcount_block_offset, s->cluster_size);
 
     /* write all the data */
-    write(fd, &header, sizeof(header));
+    ret = write(fd, &header, sizeof(header));
+    if (ret < 0)
+        goto out;
     if (backing_file) {
-        write(fd, backing_file, backing_filename_len);
+        ret = write(fd, backing_file, backing_filename_len);
+        if (ret < 0)
+            goto out;
     }
     lseek(fd, s->l1_table_offset, SEEK_SET);
     tmp = 0;
     for(i = 0;i < l1_size; i++) {
-        write(fd, &tmp, sizeof(tmp));
+        ret = write(fd, &tmp, sizeof(tmp));
+        if (ret < 0)
+            goto out;
     }
     lseek(fd, s->refcount_table_offset, SEEK_SET);
-    write(fd, s->refcount_table, s->cluster_size);
+    ret = write(fd, s->refcount_table, s->cluster_size);
+    if (ret < 0)
+        goto out;
 
     lseek(fd, s->refcount_block_offset, SEEK_SET);
-    write(fd, s->refcount_block, s->cluster_size);
+    ret = write(fd, s->refcount_block, s->cluster_size);
+    if (ret < 0)
+        goto out;
+    ret = 0;
 
+  out:
     qemu_free(s->refcount_table);
     qemu_free(s->refcount_block);
     close(fd);
-    return 0;
+    return ret;
 }
 
 



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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-devel] [PATCH] Fix the build of blktap, Yosuke Iwamatsu <=