From: Paul Eggert Date: Sat, 30 Apr 2011 01:06:41 +0000 (-0700) Subject: * dbusbind.c: Do not use XPNTR on a value that may be an integer. X-Git-Tag: emacs-pretest-24.0.90~104^2~275^2~92^2~31 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=371cac43187cce3b5cc4c1779ae059b2bafa29a0;p=emacs.git * dbusbind.c: Do not use XPNTR on a value that may be an integer. Reported by Stefan Monnier in . (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use SYMBOLP-guarded XSYMBOL, not XPNTR. --- diff --git a/src/ChangeLog b/src/ChangeLog index a2bf1fe39cf..2b71a06ae4a 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,11 @@ +2011-04-30 Paul Eggert + + * dbusbind.c: Do not use XPNTR on a value that may be an integer. + Reported by Stefan Monnier in + . + (xd_remove_watch, Fdbus_init_bus, xd_read_queued_messages): Use + SYMBOLP-guarded XSYMBOL, not XPNTR. + 2011-04-29 Paul Eggert * lisp.h (EMACS_INTPTR): Remove. All uses changed to intptr_t. diff --git a/src/dbusbind.c b/src/dbusbind.c index 06feec3e792..76035341540 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -892,7 +892,7 @@ xd_remove_watch (DBusWatch *watch, void *data) return; /* Unset session environment. */ - if (data != NULL && data == (void *) XPNTR (QCdbus_session_bus)) + if (SYMBOLP (QCdbus_session_bus) && XSYMBOL (QCdbus_session_bus) == data) { XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS"); unsetenv ("DBUS_SESSION_BUS_ADDRESS"); @@ -920,6 +920,8 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, { DBusConnection *connection; + CHECK_SYMBOL (bus); + /* Open a connection to the bus. */ connection = xd_initialize (bus, TRUE); @@ -929,7 +931,7 @@ DEFUN ("dbus-init-bus", Fdbus_init_bus, Sdbus_init_bus, 1, 1, 0, xd_add_watch, xd_remove_watch, xd_toggle_watch, - (void *) XPNTR (bus), NULL)) + XSYMBOL (bus), NULL)) XD_SIGNAL1 (build_string ("Cannot add watch functions")); /* Add bus to list of registered buses. */ @@ -1824,7 +1826,7 @@ xd_read_queued_messages (int fd, void *data, int for_read) if (data != NULL) while (!NILP (busp)) { - if (data == (void *) XPNTR (CAR_SAFE (busp))) + if (SYMBOLP (CAR_SAFE (busp)) && XSYMBOL (CAR_SAFE (busp)) == data) bus = CAR_SAFE (busp); busp = CDR_SAFE (busp); }