[telepathy-mission-control/master] mc-wait-for-name: explicitly check that argv[1] is a valid well-known name

Simon McVittie simon.mcvittie at collabora.co.uk
Mon Sep 28 06:13:12 PDT 2009


This makes the code more obviously correct, causes "mc-wait-for-name foo"
to terminate gracefully rather than criticial'ing and waiting forever,
and might also shut Coverity up.
---
 util/wait-for-name.c |    4 +++-
 1 files changed, 3 insertions(+), 1 deletions(-)

diff --git a/util/wait-for-name.c b/util/wait-for-name.c
index 19fd6f2..9756ca3 100644
--- a/util/wait-for-name.c
+++ b/util/wait-for-name.c
@@ -68,7 +68,9 @@ main (int argc,
 
   g_set_prgname ("mc-wait-for-name");
 
-  if (argc != 2)
+  if (argc != 2 ||
+      !tp_dbus_check_valid_bus_name (argv[1], TP_DBUS_NAME_TYPE_WELL_KNOWN,
+        NULL))
     {
       g_message ("Usage: mc-wait-for-name com.example.SomeBusName");
       return 2;
-- 
1.5.6.5




More information about the telepathy-commits mailing list