[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [PATCH] libxc: Fix gcc 4.3 build failure



gcc-4.3.2-1ubuntu11 complains:

xc_dom_x86.c: In function 'start_info_x86_32':
xc_dom_x86.c:421: error: format not a string literal and no format arguments
xc_dom_x86.c:421: error: format not a string literal and no format arguments
xc_dom_x86.c: In function 'start_info_x86_64':
xc_dom_x86.c:460: error: format not a string literal and no format arguments
xc_dom_x86.c:460: error: format not a string literal and no format arguments


Signed-off-by: Kouya Shimura <kouya@xxxxxxxxxxxxxx>

diff -r cc82d54bedfd tools/libxc/xc_dom_x86.c
--- a/tools/libxc/xc_dom_x86.c  Fri Dec 05 15:54:22 2008 +0000
+++ b/tools/libxc/xc_dom_x86.c  Mon Dec 08 09:26:15 2008 +0900
@@ -418,7 +418,8 @@ static int start_info_x86_32(struct xc_d
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
     memset(start_info, 0, sizeof(*start_info));
-    snprintf(start_info->magic, sizeof(start_info->magic), dom->guest_type);
+    strncpy(start_info->magic, dom->guest_type, sizeof(start_info->magic));
+    start_info->magic[sizeof(start_info->magic) - 1] = '\0';
     start_info->nr_pages = dom->total_pages;
     start_info->shared_info = shinfo << PAGE_SHIFT_X86;
     start_info->pt_base = dom->pgtables_seg.vstart;
@@ -457,7 +458,8 @@ static int start_info_x86_64(struct xc_d
     xc_dom_printf("%s: called\n", __FUNCTION__);
 
     memset(start_info, 0, sizeof(*start_info));
-    snprintf(start_info->magic, sizeof(start_info->magic), dom->guest_type);
+    strncpy(start_info->magic, dom->guest_type, sizeof(start_info->magic));
+    start_info->magic[sizeof(start_info->magic) - 1] = '\0';
     start_info->nr_pages = dom->total_pages;
     start_info->shared_info = shinfo << PAGE_SHIFT_X86;
     start_info->pt_base = dom->pgtables_seg.vstart;
_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.