Bug 20591

Summary: FTBFS: g_warning misses a NULL second parameter.
Product: Telepathy Reporter: Diego Escalante Urrelo <diegoe>
Component: tp-farsightAssignee: Telepathy bugs list <telepathy-bugs>
Status: RESOLVED FIXED QA Contact: Telepathy bugs list <telepathy-bugs>
Severity: critical    
Priority: medium CC: will
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Diego Escalante Urrelo 2009-03-10 22:52:33 UTC
Patch (against e4ae809764c46893c0d5610a8c51008381adc385):

diff --git a/telepathy-farsight/channel.c b/telepathy-farsight/channel.c
index 178a242..468925a 100644
--- a/telepathy-farsight/channel.c
+++ b/telepathy-farsight/channel.c
@@ -660,7 +660,7 @@ new_stream_cb (TfSession *session,
     {
       gchar *str = g_strdup_printf ("failed to construct TpMediaStreamHandler:"
           " bad object path '%s'?", object_path);
-      g_warning (str);
+      g_warning (str, NULL);
       tf_channel_error (self, 0, str);
       g_free (str);
       return;
@@ -688,7 +688,7 @@ new_stream_cb (TfSession *session,
       gchar *str = g_strdup_printf ("Error creating stream: %s",
           error->message);
       g_clear_error (&error);
-      g_warning (str);
+      g_warning (str, NULL);
       tf_channel_error (self, 0, str);
       g_free (str);
       return;
@@ -766,7 +766,7 @@ add_session (TfChannel *self,
           " %s",
           error->message);
       g_error_free (error);
-      g_warning (str);
+      g_warning (str, NULL);
       tf_channel_error (self, 0, str);
       g_free (str);
       return;
@@ -779,7 +779,7 @@ add_session (TfChannel *self,
       gchar *str = g_strdup_printf("failed to create session: %s",
           error->message);
       g_error_free (error);
-      g_warning (str);
+      g_warning (str, NULL);
       tf_channel_error (self, 0, str);
       g_free (str);
       return;
Comment 1 Will Thompson 2009-03-11 02:54:07 UTC
Your proposed patch is wrong: g_warning is printf-like, and doesn't need a NULL terminator. What's the actual warning you're getting?

The code is also wrong: it shouldn't be building a string and then passing it as the first argument to g_warning. The correct fix would be to change g_warning (msg); to g_warning ("%s", msg);
Comment 2 Dafydd Harries 2009-09-22 08:57:17 UTC
I'm guessing that the problem is that the compiler is warning that a printf-style function is called with a non-literal as the first argument. These calls should be of the form:

g_warning("%s", str);

Diego, can you confirm?
Comment 3 Diego Escalante Urrelo 2009-09-23 23:32:23 UTC
I dont' have a farsight src right now to check but I agree with you both.
Comment 4 Simon McVittie 2009-10-13 04:32:41 UTC
This appears to have been fixed, possibly in 0.0.7 by commit 6fae4cbe "Shut up compiler warning about unsecure printf strings".

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.