telepathy-glib: tube offering examples: don' t dump core on invalid arguments

Simon McVittie smcv at kemper.freedesktop.org
Fri Sep 6 08:09:12 PDT 2013


Module: telepathy-glib
Branch: master
Commit: c5ef21c08359eb9cc7e03d2ae8ec852e717deac7
URL:    http://cgit.freedesktop.org/telepathy/telepathy-glib/commit/?id=c5ef21c08359eb9cc7e03d2ae8ec852e717deac7

Author: Simon McVittie <simon.mcvittie at collabora.co.uk>
Date:   Fri Sep  6 13:14:29 2013 +0100

tube offering examples: don't dump core on invalid arguments

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=54061
Reviewed-by: Guillaume Desmottes <guillaume.desmottes at collabora.co.uk>

---

 examples/client/dbus-tubes/offerer.c   |    5 ++++-
 examples/client/stream-tubes/offerer.c |    6 +++++-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/examples/client/dbus-tubes/offerer.c b/examples/client/dbus-tubes/offerer.c
index 9ff053f..70d9103 100644
--- a/examples/client/dbus-tubes/offerer.c
+++ b/examples/client/dbus-tubes/offerer.c
@@ -191,7 +191,10 @@ main (int argc,
   g_type_init ();
 
   if (argc != 3)
-    g_error ("Usage: offerer gabble/jabber/ladygaga t-pain at example.com");
+    {
+      g_printerr ("Usage: offerer gabble/jabber/ladygaga t-pain at example.com\n");
+      return 2;
+    }
 
   factory = TP_SIMPLE_CLIENT_FACTORY (tp_automatic_client_factory_new (NULL));
 
diff --git a/examples/client/stream-tubes/offerer.c b/examples/client/stream-tubes/offerer.c
index 85e14a7..d6361b0 100644
--- a/examples/client/stream-tubes/offerer.c
+++ b/examples/client/stream-tubes/offerer.c
@@ -140,7 +140,11 @@ main (int argc,
   TpAccountChannelRequest *req;
   GHashTable *request;
 
-  g_assert (argc == 3);
+  if (argc != 3)
+    {
+      g_printerr ("Usage: offerer gabble/jabber/ladygaga t-pain at example.com\n");
+      return 2;
+    }
 
   g_type_init ();
 



More information about the telepathy-commits mailing list