Skip to contentSkip to conversation

Fix compilation with -Werror=format-security

DISCUSSION Frederik Himpe 3 participants 3 messages Dec 27, 2008 – Dec 28, 2008 KVM

lore
Share & tools
lore
#1 lore raw
Quoted 3 lines · Frederik Himpe

Mandriva is now using the -Werror=format-security CFLAG by default. To make kvm 82 compile with this option, I had to apply this patch:
http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/kvm/current/SOURCES/kvm-82-format-string.patch?view=co

	diff -ur kvm-82.orig/qemu/monitor.c kvm-82/qemu/monitor.c
	--- kvm-82.orig/qemu/monitor.c	2008-12-24 15:24:58.000000000 +0100
	+++ kvm-82/qemu/monitor.c	2008-12-27 20:19:32.000000000 +0100
	@@ -1975,7 +1975,7 @@
	 
	 static void expr_error(const char *fmt)
	 {
	-    term_printf(fmt);
	+    term_printf("%s", fmt);
	     term_printf("\n");
	     longjmp(expr_env, 1);
	 }

Why not make this term_printf("%s\n", fmt); while you're at it?

#2 lore raw
Quoted 20 lines · Lennert Buytenhek
Quoted 3 lines · Frederik Himpe

Mandriva is now using the -Werror=format-security CFLAG by default. To make kvm 82 compile with this option, I had to apply this patch:
http://svn.mandriva.com/cgi-bin/viewvc.cgi/packages/cooker/kvm/current/SOURCES/kvm-82-format-string.patch?view=co

        diff -ur kvm-82.orig/qemu/monitor.c kvm-82/qemu/monitor.c
        --- kvm-82.orig/qemu/monitor.c  2008-12-24 15:24:58.000000000 +0100
        +++ kvm-82/qemu/monitor.c       2008-12-27 20:19:32.000000000 +0100
        @@ -1975,7 +1975,7 @@

         static void expr_error(const char *fmt)
         {
        -    term_printf(fmt);
        +    term_printf("%s", fmt);
             term_printf("\n");
             longjmp(expr_env, 1);
         }
Quoted 1 line

Why not make this term_printf("%s\n", fmt); while you're at it?

Thanks, I combined these to form r6134. As "fmt" no longer describes the parameter, I changed that to "msg".