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-changelog

[Xen-changelog] [xen-unstable] blktap: Fix compile errors

To: xen-changelog@xxxxxxxxxxxxxxxxxxx
Subject: [Xen-changelog] [xen-unstable] blktap: Fix compile errors
From: Xen patchbot-unstable <patchbot-unstable@xxxxxxxxxxxxxxxxxxx>
Date: Mon, 04 Jun 2007 03:15:39 -0700
Delivery-date: Mon, 04 Jun 2007 03:16:45 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
List-help: <mailto:xen-changelog-request@lists.xensource.com?subject=help>
List-id: BK change log <xen-changelog.lists.xensource.com>
List-post: <mailto:xen-changelog@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-changelog>, <mailto:xen-changelog-request@lists.xensource.com?subject=unsubscribe>
Reply-to: xen-devel@xxxxxxxxxxxxxxxxxxx
Sender: xen-changelog-bounces@xxxxxxxxxxxxxxxxxxx
# HG changeset patch
# User kfraser@xxxxxxxxxxxxxxxxxxxxx
# Date 1180012060 -3600
# Node ID 965bf43c9f1139135c2956cf90f916c335fd8e77
# Parent  f07c1bb86d6c54458ff944e71453173cbf567ed2
blktap: Fix compile errors

When compiling the various blktap drivers with warnings cranked up, I
get errors that return values are not checked.

Signed-off-by: Charles Coffing <ccoffing@xxxxxxxxxx>
---
 tools/blktap/drivers/blktapctrl.c |    5 ++++-
 tools/blktap/drivers/block-qcow.c |    9 ++++++---
 tools/blktap/drivers/block-vmdk.c |    5 +++--
 3 files changed, 13 insertions(+), 6 deletions(-)

diff -r f07c1bb86d6c -r 965bf43c9f11 tools/blktap/drivers/blktapctrl.c
--- a/tools/blktap/drivers/blktapctrl.c Thu May 24 14:05:58 2007 +0100
+++ b/tools/blktap/drivers/blktapctrl.c Thu May 24 14:07:40 2007 +0100
@@ -678,7 +678,10 @@ int main(int argc, char *argv[])
        __init_blkif();
        snprintf(buf, sizeof(buf), "BLKTAPCTRL[%d]", getpid());
        openlog(buf, LOG_CONS|LOG_ODELAY, LOG_DAEMON);
-       daemon(0,0);
+       if (daemon(0,0)) {
+               DPRINTF("daemon failed (%d)\n", errno);
+               goto open_failed;
+       }
 
        print_drivers();
        init_driver_list();
diff -r f07c1bb86d6c -r 965bf43c9f11 tools/blktap/drivers/block-qcow.c
--- a/tools/blktap/drivers/block-qcow.c Thu May 24 14:05:58 2007 +0100
+++ b/tools/blktap/drivers/block-qcow.c Thu May 24 14:07:40 2007 +0100
@@ -745,7 +745,10 @@ found:
                }
                memcpy(tmp_ptr2, l2_ptr, 4096);
                lseek(s->fd, l2_offset + (l2_sector << 12), SEEK_SET);
-               write(s->fd, tmp_ptr2, 4096);
+               if (write(s->fd, tmp_ptr2, 4096) != 4096) {
+                       free(tmp_ptr2);
+                       return -1;
+               }
                free(tmp_ptr2);
        }
        return cluster_offset;
@@ -1252,8 +1255,8 @@ int qcow_create(const char *filename, ui
                                strncpy(backing_filename, backing_file,
                                        sizeof(backing_filename));
                        } else {
-                               realpath(backing_file, backing_filename);
-                               if (stat(backing_filename, &st) != 0) {
+                               if (realpath(backing_file, backing_filename) == 
NULL ||
+                                   stat(backing_filename, &st) != 0) {
                                        return -1;
                                }
                        }
diff -r f07c1bb86d6c -r 965bf43c9f11 tools/blktap/drivers/block-vmdk.c
--- a/tools/blktap/drivers/block-vmdk.c Thu May 24 14:05:58 2007 +0100
+++ b/tools/blktap/drivers/block-vmdk.c Thu May 24 14:07:40 2007 +0100
@@ -283,8 +283,9 @@ static uint64_t get_cluster_offset(struc
                if (!allocate)
                        return 0;
                cluster_offset = lseek(prv->fd, 0, SEEK_END);
-               ftruncate(prv->fd, cluster_offset + 
-                         (prv->cluster_sectors << 9));
+               if (ftruncate(prv->fd, cluster_offset + 
+                             (prv->cluster_sectors << 9)))
+                       return 0;
                cluster_offset >>= 9;
                /* update L2 table */
                tmp = cpu_to_le32(cluster_offset);

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

<Prev in Thread] Current Thread [Next in Thread>
  • [Xen-changelog] [xen-unstable] blktap: Fix compile errors, Xen patchbot-unstable <=