dbus/dbus/tools [POSSIBLY UNSAFE]

Colin Walters walters at verbum.org
Wed Aug 11 07:59:33 PDT 2004


CVS commit by walters: 

2004-08-11  Colin Walters  <walters at redhat.com>

	* tools/dbus-send.c (main, usage): Add --reply-timeout
	argument.


  M +9 -2      dbus/dbus/tools/dbus-send.c   1.9 [POSSIBLY UNSAFE: printf]


--- dbus/dbus/tools/dbus-send.c  #1.8:1.9
@@ -31,5 +31,5 @@ static void
 usage (char *name, int ecode)
 {
-  fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] <destination object path> <message name> [contents ...]\n", name);
+  fprintf (stderr, "Usage: %s [--help] [--system | --session] [--dest=SERVICE] [--type=TYPE] [--print-reply] [--reply-timeout=MSEC] <destination object path> <message name> [contents ...]\n", name);
   exit (ecode);
 }
@@ -42,4 +42,5 @@ main (int argc, char *argv[])
   DBusMessage *message;
   int print_reply;
+  int reply_timeout;
   DBusMessageIter iter;
   int i;
@@ -55,4 +56,5 @@ main (int argc, char *argv[])
 
   print_reply = FALSE;
+  reply_timeout = -1;
   
   for (i = 1; i < argc && name == NULL; i++)
@@ -69,4 +71,9 @@ main (int argc, char *argv[])
           message_type = DBUS_MESSAGE_TYPE_METHOD_CALL;
         }
+      else if (strstr (arg, "--reply-timeout=") == arg)
+        {
+          reply_timeout = strtol (strchr (arg, '=') + 1,
+                                  NULL, 10);
+        }
       else if (strstr (arg, "--dest=") == arg)
         dest = strchr (arg, '=') + 1;
@@ -255,5 +262,5 @@ main (int argc, char *argv[])
       dbus_error_init (&error);
       reply = dbus_connection_send_with_reply_and_block (connection,
-                                                         message, -1,
+                                                         message, reply_timeout,
                                                          &error);
       if (dbus_error_is_set (&error))




More information about the dbus-commit mailing list