diff -r 6706934cdf9d tools/blktap/drivers/blktapctrl.c --- a/tools/blktap/drivers/blktapctrl.c Tue Dec 04 11:23:05 2007 +0000 +++ b/tools/blktap/drivers/blktapctrl.c Tue Dec 04 15:06:49 2007 +0100 @@ -37,7 +37,7 @@ #include #include #include -#include +#include #include #include #include @@ -684,7 +684,7 @@ static void write_pidfile(long pid) exit(1); } - len = sprintf(buf, "%ld\n", pid); + len = snprintf(buf, sizeof(buf), "%ld\n", pid); if (write(fd, buf, len) != len) { DPRINTF("Writing pid file failed (%d)\n", errno); exit(1); diff -r 6706934cdf9d tools/blktap/drivers/bswap.h --- a/tools/blktap/drivers/bswap.h Tue Dec 04 11:23:05 2007 +0000 +++ b/tools/blktap/drivers/bswap.h Tue Dec 04 15:06:49 2007 +0100 @@ -5,9 +5,14 @@ #include -#if defined(__NetBSD__) || defined(__OpenBSD__) +#if defined(__NetBSD__) #include #include +#elif defined(__OpenBSD__) +#include +#define bswap_16(x) swap16(x) +#define bswap_32(x) swap32(x) +#define bswap_64(x) swap64(x) #else #ifdef HAVE_BYTESWAP_H diff -r 6706934cdf9d tools/blktap/lib/blktaplib.h --- a/tools/blktap/lib/blktaplib.h Tue Dec 04 11:23:05 2007 +0000 +++ b/tools/blktap/lib/blktaplib.h Tue Dec 04 15:06:49 2007 +0100 @@ -33,6 +33,7 @@ #define __BLKTAPLIB_H__ #include +#include #include #include #include diff -r 6706934cdf9d tools/blktap/lib/list.h --- a/tools/blktap/lib/list.h Tue Dec 04 11:23:05 2007 +0000 +++ b/tools/blktap/lib/list.h Tue Dec 04 15:06:49 2007 +0100 @@ -7,6 +7,10 @@ #ifndef __LIST_H__ #define __LIST_H__ + +#ifdef LIST_HEAD +#undef LIST_HEAD +#endif #define LIST_POISON1 ((void *) 0x00100100) #define LIST_POISON2 ((void *) 0x00200200) diff -r 6706934cdf9d tools/blktap/lib/xs_api.c --- a/tools/blktap/lib/xs_api.c Tue Dec 04 11:23:05 2007 +0000 +++ b/tools/blktap/lib/xs_api.c Tue Dec 04 15:06:49 2007 +0100 @@ -282,7 +282,7 @@ int register_xenbus_watch(struct xs_hand /* Pointer in ascii is the token. */ char token[sizeof(watch) * 2 + 1]; - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); if (find_watch(token)) { DPRINTF("watch collision!\n"); return -EINVAL; @@ -302,7 +302,7 @@ int unregister_xenbus_watch(struct xs_ha { char token[sizeof(watch) * 2 + 1]; - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); if (!find_watch(token)) { DPRINTF("no such watch!\n"); return -EINVAL; @@ -326,7 +326,7 @@ void reregister_xenbus_watches(struct xs char token[sizeof(watch) * 2 + 1]; list_for_each_entry(watch, &watches, list) { - sprintf(token, "%lX", (long)watch); + snprintf(token, sizeof(token), "%lX", (long)watch); xs_watch(h, watch->node, token); } }