aboutsummaryrefslogtreecommitdiffstats
path: root/src/dbusbind.c
diff options
context:
space:
mode:
authorPaul Eggert2011-09-01 07:44:49 -0700
committerPaul Eggert2011-09-01 07:44:49 -0700
commit8666506ecd6b1a90c7c66fb4b6051e90fba20c30 (patch)
tree5f853c76e609cf303965e7cd7eb361e011e98641 /src/dbusbind.c
parent726cfaae869af4f678e26ace56d7dc42676bc299 (diff)
downloademacs-8666506ecd6b1a90c7c66fb4b6051e90fba20c30.tar.gz
emacs-8666506ecd6b1a90c7c66fb4b6051e90fba20c30.zip
* src/doprnt.c (esnprintf): Remove. All uses removed.
Suggested by Chong Yidong in <http://debbugs.gnu.org/cgi/bugreport.cgi?bug=9412#23>.
Diffstat (limited to 'src/dbusbind.c')
-rw-r--r--src/dbusbind.c42
1 files changed, 28 insertions, 14 deletions
diff --git a/src/dbusbind.c b/src/dbusbind.c
index fd9a43aaf86..8dac2a6249f 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -284,6 +284,7 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
284 unsigned int subtype; 284 unsigned int subtype;
285 Lisp_Object elt; 285 Lisp_Object elt;
286 char const *subsig; 286 char const *subsig;
287 int subsiglen;
287 char x[DBUS_MAXIMUM_SIGNATURE_LENGTH]; 288 char x[DBUS_MAXIMUM_SIGNATURE_LENGTH];
288 289
289 elt = object; 290 elt = object;
@@ -365,9 +366,9 @@ xd_signature (char *signature, unsigned int dtype, unsigned int parent_type, Lis
365 elt = CDR_SAFE (XD_NEXT_VALUE (elt)); 366 elt = CDR_SAFE (XD_NEXT_VALUE (elt));
366 } 367 }
367 368
368 if (esnprintf (signature, DBUS_MAXIMUM_SIGNATURE_LENGTH, 369 subsiglen = snprintf (signature, DBUS_MAXIMUM_SIGNATURE_LENGTH,
369 "%c%s", dtype, subsig) 370 "%c%s", dtype, subsig);
370 == DBUS_MAXIMUM_SIGNATURE_LENGTH - 1) 371 if (! (0 <= subsiglen && subsiglen < DBUS_MAXIMUM_SIGNATURE_LENGTH))
371 string_overflow (); 372 string_overflow ();
372 break; 373 break;
373 374
@@ -2088,32 +2089,45 @@ usage: (dbus-register-signal BUS SERVICE PATH INTERFACE SIGNAL HANDLER &rest ARG
2088 connection = xd_initialize (bus, TRUE); 2089 connection = xd_initialize (bus, TRUE);
2089 2090
2090 /* Create a rule to receive related signals. */ 2091 /* Create a rule to receive related signals. */
2091 rulelen = esnprintf (rule, sizeof rule, 2092 rulelen = snprintf (rule, sizeof rule,
2092 "type='signal',interface='%s',member='%s'", 2093 "type='signal',interface='%s',member='%s'",
2093 SDATA (interface), 2094 SDATA (interface),
2094 SDATA (signal)); 2095 SDATA (signal));
2096 if (! (0 <= rulelen && rulelen < sizeof rule))
2097 string_overflow ();
2095 2098
2096 /* Add unique name and path to the rule if they are non-nil. */ 2099 /* Add unique name and path to the rule if they are non-nil. */
2097 if (!NILP (uname)) 2100 if (!NILP (uname))
2098 rulelen += esnprintf (rule + rulelen, sizeof rule - rulelen, 2101 {
2102 int len = snprintf (rule + rulelen, sizeof rule - rulelen,
2099 ",sender='%s'", SDATA (uname)); 2103 ",sender='%s'", SDATA (uname));
2104 if (! (0 <= len && len < sizeof rule - rulelen))
2105 string_overflow ();
2106 rulelen += len;
2107 }
2100 2108
2101 if (!NILP (path)) 2109 if (!NILP (path))
2102 rulelen += esnprintf (rule + rulelen, sizeof rule - rulelen, 2110 {
2111 int len = snprintf (rule + rulelen, sizeof rule - rulelen,
2103 ",path='%s'", SDATA (path)); 2112 ",path='%s'", SDATA (path));
2113 if (! (0 <= len && len < sizeof rule - rulelen))
2114 string_overflow ();
2115 rulelen += len;
2116 }
2104 2117
2105 /* Add arguments to the rule if they are non-nil. */ 2118 /* Add arguments to the rule if they are non-nil. */
2106 for (i = 6; i < nargs; ++i) 2119 for (i = 6; i < nargs; ++i)
2107 if (!NILP (args[i])) 2120 if (!NILP (args[i]))
2108 { 2121 {
2122 int len;
2109 CHECK_STRING (args[i]); 2123 CHECK_STRING (args[i]);
2110 rulelen += esnprintf (rule + rulelen, sizeof rule - rulelen, 2124 len = snprintf (rule + rulelen, sizeof rule - rulelen,
2111 ",arg%"pD"d='%s'", i - 6, SDATA (args[i])); 2125 ",arg%"pD"d='%s'", i - 6, SDATA (args[i]));
2126 if (! (0 <= len && len < sizeof rule - rulelen))
2127 string_overflow ();
2128 rulelen += len;
2112 } 2129 }
2113 2130
2114 if (rulelen == sizeof rule - 1)
2115 string_overflow ();
2116
2117 /* Add the rule to the bus. */ 2131 /* Add the rule to the bus. */
2118 dbus_error_init (&derror); 2132 dbus_error_init (&derror);
2119 dbus_bus_add_match (connection, rule, &derror); 2133 dbus_bus_add_match (connection, rule, &derror);