]> code.delx.au - gnu-emacs/blobdiff - src/dbusbind.c
Update copyright year to 2015
[gnu-emacs] / src / dbusbind.c
index 9e15d7f199a8b0272936d4b48d66fbbc6ed1077b..9de694954d4362bed881047c9e19ce0ca2011b67 100644 (file)
@@ -1,5 +1,5 @@
 /* Elisp bindings for D-Bus.
-   Copyright (C) 2007-2014 Free Software Foundation, Inc.
+   Copyright (C) 2007-2015 Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -357,7 +357,7 @@ xd_signature_cat (char *signature, char const *x)
   ptrdiff_t xlen = strlen (x);
   if (DBUS_MAXIMUM_SIGNATURE_LENGTH - xlen <= siglen)
     string_overflow ();
-  strcat (signature, x);
+  strcpy (signature + siglen, x);
 }
 
 /* Compute SIGNATURE of OBJECT.  It must have a form that it can be
@@ -387,8 +387,8 @@ xd_signature (char *signature, int dtype, int parent_type, Lisp_Object object)
       break;
 
     case DBUS_TYPE_BOOLEAN:
-      /* Every Emacs Lisp object serves as a boolean, so there's nothing
-        to check.  */
+      if (!EQ (object, Qt) && !EQ (object, Qnil))
+       wrong_type_argument (intern ("booleanp"), object);
       sprintf (signature, "%c", dtype);
       break;
 
@@ -761,7 +761,7 @@ xd_append_arg (int dtype, Lisp_Object object, DBusMessageIter *iter)
                && STRINGP (CAR_SAFE (XD_NEXT_VALUE (object)))
                && NILP (CDR_SAFE (XD_NEXT_VALUE (object))))
              {
-               strcpy (signature, SSDATA (CAR_SAFE (XD_NEXT_VALUE (object))));
+               lispstpcpy (signature, CAR_SAFE (XD_NEXT_VALUE (object)));
                object = CDR_SAFE (XD_NEXT_VALUE (object));
              }
 
@@ -1054,6 +1054,7 @@ xd_remove_watch (DBusWatch *watch, void *data)
 
   /* Unset session environment.  */
 #if 0
+  /* This is buggy, since unsetenv is not thread-safe.  */
   if (XSYMBOL (QCdbus_session_bus) == data)
     {
       XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS");
@@ -1219,9 +1220,6 @@ this connection to those buses.  */)
       XSETFASTINT (val, (intptr_t) connection);
       xd_registered_buses = Fcons (Fcons (bus, val), xd_registered_buses);
 
-      /* We do not want to abort.  */
-      xputenv ("DBUS_FATAL_WARNINGS=0");
-
       /* Cleanup.  */
       dbus_error_free (&derror);
     }
@@ -1737,6 +1735,13 @@ xd_read_queued_messages (int fd, void *data)
 }
 
 \f
+void
+init_dbusbind (void)
+{
+  /* We do not want to abort.  */
+  xputenv ("DBUS_FATAL_WARNINGS=0");
+}
+
 void
 syms_of_dbusbind (void)
 {