comparison src/dbusbind.c @ 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 5d614d0d26de
children b0fa771b5389
comparison
equal deleted inserted replaced
96846:0807daabeb14 96847:5129bcf1c53e
1312 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 1312 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
1313 Lisp_Object uname, key, key1, value; 1313 Lisp_Object uname, key, key1, value;
1314 DBusConnection *connection; 1314 DBusConnection *connection;
1315 int i; 1315 int i;
1316 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH]; 1316 char rule[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
1317 char x[DBUS_MAXIMUM_MATCH_RULE_LENGTH];
1317 DBusError derror; 1318 DBusError derror;
1318 1319
1319 /* Check parameters. */ 1320 /* Check parameters. */
1320 bus = args[0]; 1321 bus = args[0];
1321 service = args[1]; 1322 service = args[1];
1364 SDATA (interface), 1365 SDATA (interface),
1365 SDATA (signal)); 1366 SDATA (signal));
1366 1367
1367 /* Add unique name and path to the rule if they are non-nil. */ 1368 /* Add unique name and path to the rule if they are non-nil. */
1368 if (!NILP (uname)) 1369 if (!NILP (uname))
1369 sprintf (rule, "%s,sender='%s'", rule, SDATA (uname)); 1370 {
1371 sprintf (x, ",sender='%s'", SDATA (uname));
1372 strcat (rule, x);
1373 }
1370 1374
1371 if (!NILP (path)) 1375 if (!NILP (path))
1372 sprintf (rule, "%s,path='%s'", rule, SDATA (path)); 1376 {
1377 sprintf (x, ",path='%s'", SDATA (path));
1378 strcat (rule, x);
1379 }
1373 1380
1374 /* Add arguments to the rule if they are non-nil. */ 1381 /* Add arguments to the rule if they are non-nil. */
1375 for (i = 6; i < nargs; ++i) 1382 for (i = 6; i < nargs; ++i)
1376 if (!NILP (args[i])) 1383 if (!NILP (args[i]))
1377 { 1384 {
1378 CHECK_STRING (args[i]); 1385 CHECK_STRING (args[i]);
1379 sprintf (rule, "%s,arg%d='%s'", rule, i-6, SDATA (args[i])); 1386 sprintf (x, ",arg%d='%s'", i-6, SDATA (args[i]));
1387 strcat (rule, x);
1380 } 1388 }
1381 1389
1382 /* Add the rule to the bus. */ 1390 /* Add the rule to the bus. */
1383 dbus_error_init (&derror); 1391 dbus_error_init (&derror);
1384 dbus_bus_add_match (connection, rule, &derror); 1392 dbus_bus_add_match (connection, rule, &derror);