add -Wformat and -Wformat-security warnings and fix up some code
authorDavid Zeuthen <davidz@redhat.com>
Fri, 30 May 2008 21:35:53 +0000 (17:35 -0400)
committerDavid Zeuthen <davidz@redhat.com>
Fri, 30 May 2008 21:35:53 +0000 (17:35 -0400)
I'm still baffled why gcc thinks this is something one needs to *turn* on.

configure.in
src/devkit-disks-daemon.c
src/devkit-disks-device.c
src/devkit-disks-logger.c

index dec5c59..a0e550d 100644 (file)
@@ -73,6 +73,16 @@ if test "x$GCC" = "xyes"; then
   *) CFLAGS="$CFLAGS -Wsign-compare" ;;
   esac
 
+  case " $CFLAGS " in
+  *[\ \        ]-Wformat[\ \   ]*) ;;
+  *) CFLAGS="$CFLAGS -Wformat" ;;
+  esac
+
+  case " $CFLAGS " in
+  *[\ \        ]-Wformat-security[\ \  ]*) ;;
+  *) CFLAGS="$CFLAGS -Wformat-security" ;;
+  esac
+
   if test "x$enable_ansi" = "xyes"; then
     case " $CFLAGS " in
     *[\ \      ]-ansi[\ \      ]*) ;;
index 03e89ea..6042c72 100644 (file)
@@ -914,7 +914,7 @@ throw_error (DBusGMethodInvocation *context, int error_code, const char *format,
 
         error = g_error_new (DEVKIT_DISKS_DAEMON_ERROR,
                              error_code,
-                             message);
+                             "%s", message);
         dbus_g_method_return_error (context, error);
         g_error_free (error);
         g_free (message);
index 4e456b0..5ae347f 100644 (file)
@@ -2355,7 +2355,7 @@ throw_error (DBusGMethodInvocation *context, int error_code, const char *format,
 
         error = g_error_new (DEVKIT_DISKS_DEVICE_ERROR,
                              error_code,
-                             message);
+                             "%s", message);
         dbus_g_method_return_error (context, error);
         g_error_free (error);
         g_free (message);
index 148a431..86a74fc 100644 (file)
@@ -275,7 +275,7 @@ throw_error (DBusGMethodInvocation *context, int error_code, const char *format,
 
         error = g_error_new (DEVKIT_DISKS_DEVICE_ERROR,
                              error_code,
-                             message);
+                             "%s", message);
         dbus_g_method_return_error (context, error);
         g_error_free (error);
         g_free (message);