summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-18 14:07:57 +0100
committerSimon McVittie <simon.mcvittie@collabora.co.uk>2013-09-19 14:25:33 +0100
commitcc2af09f608511bf316e94e4462ff041406c455b (patch)
tree4211c5939a6ee36d0553492b9d79072837dea51c
parentfe1e8ce4b830f665fbe098b1928969d26c553441 (diff)
downloadtelepathy-mission-control-cc2af09f608511bf316e94e4462ff041406c455b.tar.gz
Flag printf-ish functions with G_GNUC_PRINTF and fix resulting warnings
In particular, mcd-account-manager-default could crash when migrating an account, since it would dereference arbitrary stack contents as a pointer-to-string. Bug: https://bugs.freedesktop.org/show_bug.cgi?id=69542 Reviewed-by: Guillaume Desmottes <guillaume.desmottes@collabora.co.uk>
-rw-r--r--src/mcd-account-manager-default.c3
-rw-r--r--src/mcd-account.c2
-rw-r--r--src/mcd-connection.c2
-rw-r--r--src/mcd-debug.h2
-rw-r--r--src/mcd-dispatcher.c2
-rw-r--r--tests/account-store.c4
6 files changed, 8 insertions, 7 deletions
diff --git a/src/mcd-account-manager-default.c b/src/mcd-account-manager-default.c
index e73fca16..0a89fe1a 100644
--- a/src/mcd-account-manager-default.c
+++ b/src/mcd-account-manager-default.c
@@ -343,7 +343,8 @@ _list (const McpAccountStorage *self,
if (_commit (self, am, NULL))
{
- DEBUG ("Migrated %s to new location: deleting old copy");
+ DEBUG ("Migrated %s to new location: deleting old copy",
+ old_filename);
if (g_unlink (old_filename) != 0)
g_warning ("Unable to delete %s: %s", old_filename,
g_strerror (errno));
diff --git a/src/mcd-account.c b/src/mcd-account.c
index 77b6153d..52bad978 100644
--- a/src/mcd-account.c
+++ b/src/mcd-account.c
@@ -2673,7 +2673,7 @@ apply_parameter_updates (McdAccount *account,
g_hash_table_iter_init (&iter, dbus_properties);
while (g_hash_table_iter_next (&iter, &name, &value))
{
- DEBUG ("updating parameter %s", name);
+ DEBUG ("updating parameter %s", (const gchar *) name);
_mcd_connection_update_property (priv->connection, name, value);
}
}
diff --git a/src/mcd-connection.c b/src/mcd-connection.c
index 1e5955a0..1d71da4e 100644
--- a/src/mcd-connection.c
+++ b/src/mcd-connection.c
@@ -705,7 +705,7 @@ connection_should_reconnect (TpConnection *tp_conn,
{
case TP_DBUS_ERROR_NAME_OWNER_LOST:
/* CM crashed */
- DEBUG ("dbus error code: OWNER_LOST, reconnecting", code);
+ DEBUG ("dbus error code: OWNER_LOST, reconnecting");
return TRUE;
}
}
diff --git a/src/mcd-debug.h b/src/mcd-debug.h
index f91e69d1..6cd9e08d 100644
--- a/src/mcd-debug.h
+++ b/src/mcd-debug.h
@@ -70,7 +70,7 @@ static inline gint _mcd_debug_get_level (void)
void mcd_debug_print_tree (gpointer obj);
-void mcd_debug (const gchar *format, ...);
+void mcd_debug (const gchar *format, ...) G_GNUC_PRINTF (1, 2);
G_END_DECLS
diff --git a/src/mcd-dispatcher.c b/src/mcd-dispatcher.c
index caa70076..5fea7f27 100644
--- a/src/mcd-dispatcher.c
+++ b/src/mcd-dispatcher.c
@@ -2051,7 +2051,7 @@ try_delegating (ChannelToDelegate *to_delegate)
g_strdup (mcd_channel_get_object_path (to_delegate->channel)),
v);
- DEBUG ("...but failed to delegate it: %s",
+ DEBUG ("...but failed to delegate %s: %s",
mcd_channel_get_object_path (to_delegate->channel),
to_delegate->error->message);
diff --git a/tests/account-store.c b/tests/account-store.c
index 75860d85..4482ea5b 100644
--- a/tests/account-store.c
+++ b/tests/account-store.c
@@ -83,7 +83,7 @@ const Backend backends[] = {
};
static void usage (const gchar *name, const gchar *fmt,
- ...) G_GNUC_NORETURN;
+ ...) G_GNUC_NORETURN G_GNUC_PRINTF (2, 3);
int main (int argc, char **argv)
{
@@ -102,7 +102,7 @@ int main (int argc, char **argv)
g_set_application_name (argv[0]);
if (argc < 3)
- usage (argv[0], "");
+ usage (argv[0], "Not enough arguments");
op_name = argv[1];
backend = argv[2];