changeset 96847:5129bcf1c53e

* dbusbind.c (Fdbus_register_signal): Use sprintf + strcat instead only sprintf.
author Michael Albinus <michael.albinus@gmx.de>
date Mon, 21 Jul 2008 04:27:38 +0000
parents 0807daabeb14
children 0f450c5af24a
files src/dbusbind.c
diffstat 1 files changed, 11 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/src/dbusbind.c	Mon Jul 21 04:20:56 2008 +0000
+++ b/src/dbusbind.c	Mon Jul 21 04:27:38 2008 +0000
@@ -1314,6 +1314,7 @@
   DBusConnection *connection;
   int i;
   char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
+  char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
   DBusError derror;
 
   /* Check parameters.  */
@@ -1366,17 +1367,24 @@
 
       /* Add unique name and path to the rule if they are non-nil.  */
       if (!NILP (uname))
-	sprintf (rule, "%s,sender='%s'", rule, SDATA (uname));
+	{
+	  sprintf (x, ",sender='%s'", SDATA (uname));
+	  strcat (rule, x);
+	}
 
       if (!NILP (path))
-	sprintf (rule, "%s,path='%s'", rule, SDATA (path));
+	{
+	  sprintf (x, ",path='%s'", SDATA (path));
+	  strcat (rule, x);
+	}
 
       /* Add arguments to the rule if they are non-nil.  */
       for (i = 6; i < nargs; ++i)
 	if (!NILP (args[i]))
 	  {
 	    CHECK_STRING (args[i]);
-	    sprintf (rule, "%s,arg%d='%s'", rule, i-6, SDATA (args[i]));
+	    sprintf (x, ",arg%d='%s'", i-6, SDATA (args[i]));
+	    strcat (rule, x);
 	  }
 
       /* Add the rule to the bus.  */