[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] blktap: Fix compile errors
# 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
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |