All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yosuke Iwamatsu <y-iwamatsu@ab.jp.nec.com>
To: xen-devel@lists.xensource.com
Subject: [PATCH] Fix the build of blktap
Date: Mon, 09 Mar 2009 18:31:25 +0900	[thread overview]
Message-ID: <49B4E1ED.4070600@ab.jp.nec.com> (raw)

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@ab.jp.nec.com>

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;
 }

                 reply	other threads:[~2009-03-09  9:31 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=49B4E1ED.4070600@ab.jp.nec.com \
    --to=y-iwamatsu@ab.jp.nec.com \
    --cc=xen-devel@lists.xensource.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.