diff --git a/src/dbusbind.c b/src/dbusbind.c index d96b735c79a..96f9329a97e 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -276,7 +276,9 @@ XD_OBJECT_TO_STRING (Lisp_Object object) #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ do { \ - char const *session_bus_address = getenv ("DBUS_SESSION_BUS_ADDRESS"); \ + Lisp_Object session_bus_address \ + = Fgetenv_internal (build_string ("DBUS_SESSION_BUS_ADDRESS"), \ + Qnil); \ if (STRINGP (bus)) \ { \ DBusAddressEntry **entries; \ @@ -289,9 +291,8 @@ #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ dbus_error_free (&derror); \ dbus_address_entries_free (entries); \ /* Canonicalize session bus address. */ \ - if ((session_bus_address != NULL) \ - && (!NILP (Fstring_equal \ - (bus, build_string (session_bus_address))))) \ + if ((STRINGP (session_bus_address)) \ + && (!NILP (Fstring_equal (bus, session_bus_address)))) \ bus = QCsession; \ } \ \ @@ -304,7 +305,7 @@ #define XD_DBUS_VALIDATE_BUS_ADDRESS(bus) \ XD_SIGNAL2 (build_string ("Wrong bus name"), bus); \ /* We do not want to have an autolaunch for the session bus. */ \ if ((EQ (bus, QCsession) || EQ (bus, QCsession_private)) \ - && session_bus_address == NULL) \ + && NILP (session_bus_address)) \ XD_SIGNAL2 (build_string ("No connection to bus"), bus); \ } \ } while (0)