[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen-unstable] blktap2: A final few NetBSD fixes
# HG changeset patch # User Keir Fraser <keir.fraser@xxxxxxxxxx> # Date 1245853493 -3600 # Node ID f3a909c8e8e67e875c2b357a7f4801b79b42ece4 # Parent f1fec38c8228b25393c906408af5c49992c487e6 blktap2: A final few NetBSD fixes Signed-off-by: Christoph Egger <Christoph.Egger@xxxxxxx> --- tools/blktap2/include/blk_uuid.h | 10 +++++++--- tools/blktap2/vhd/lib/libvhd.c | 4 ++-- tools/blktap2/vhd/lib/vhd-util-read.c | 4 ++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff -r f1fec38c8228 -r f3a909c8e8e6 tools/blktap2/include/blk_uuid.h --- a/tools/blktap2/include/blk_uuid.h Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/include/blk_uuid.h Wed Jun 24 15:24:53 2009 +0100 @@ -45,7 +45,7 @@ static inline void blk_uuid_generate(blk uuid_generate(uuid->uuid); } -static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out) +static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out, size_t size) { uuid_unparse(uuid->uuid, out); } @@ -74,6 +74,7 @@ static inline int blk_uuid_compare(blk_u #include <uuid.h> #include <string.h> +#include <stdlib.h> typedef uuid_t blk_uuid_t; @@ -89,10 +90,13 @@ static inline void blk_uuid_generate(blk uuid_create((uuid_t *)uuid, &status); } -static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out) +static inline void blk_uuid_to_string(blk_uuid_t *uuid, char *out, size_t size) { uint32_t status; - uuid_to_string((uuid_t *)uuid, &out, &status); + char *_out = NULL; + uuid_to_string((uuid_t *)uuid, &_out, &status); + strlcpy(out, _out, size); + free(_out); } static inline void blk_uuid_from_string(blk_uuid_t *uuid, const char *in) diff -r f1fec38c8228 -r f3a909c8e8e6 tools/blktap2/vhd/lib/libvhd.c --- a/tools/blktap2/vhd/lib/libvhd.c Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/vhd/lib/libvhd.c Wed Jun 24 15:24:53 2009 +0100 @@ -1335,7 +1335,7 @@ vhd_macx_encode_location(char *name, cha snprintf(uri, ibl+1, "file://%s", name); if (iconv(cd, -#if defined(__linux__) || (__Linux__) +#if defined(__linux__) || defined(__Linux__) (char **) #endif &urip, &ibl, &uri_utf8p, &obl) == (size_t)-1 || @@ -1425,7 +1425,7 @@ vhd_w2u_encode_location(char *name, char } if (iconv(cd, -#if defined(__linux__) || (__Linux__) +#if defined(__linux__) || defined(__Linux__) (char **) #endif &urip, &ibl, &uri_utf16p, &obl) == (size_t)-1 || diff -r f1fec38c8228 -r f3a909c8e8e6 tools/blktap2/vhd/lib/vhd-util-read.c --- a/tools/blktap2/vhd/lib/vhd-util-read.c Wed Jun 24 14:03:20 2009 +0100 +++ b/tools/blktap2/vhd/lib/vhd-util-read.c Wed Jun 24 15:24:53 2009 +0100 @@ -78,7 +78,7 @@ vhd_print_header(vhd_context_t *vhd, vhd (err ? "failed to read name" : name)); free(name); - blk_uuid_to_string(&h->prt_uuid, uuid); + blk_uuid_to_string(&h->prt_uuid, uuid, sizeof(uuid)); printf("Parent UUID : %s\n", uuid); vhd_time_to_string(h->prt_ts, time_str); @@ -153,7 +153,7 @@ vhd_print_footer(vhd_footer_t *f, int he printf("Checksum : 0x%x|0x%x (%s)\n", f->checksum, cksm, f->checksum == cksm ? "Good!" : "Bad!"); - blk_uuid_to_string(&f->uuid, uuid); + blk_uuid_to_string(&f->uuid, uuid, sizeof(uuid)); printf("UUID : %s\n", uuid); printf("Saved state : %s\n", f->saved == 0 ? "No" : "Yes"); _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxxxxxxxx http://lists.xensource.com/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |