Index: gdm-queue.c
===================================================================
--- gdm-queue.c	(revision 391)
+++ gdm-queue.c	(working copy)
@@ -29,6 +29,7 @@
 #include <fcntl.h>
 #include <sys/types.h>
 #include <sys/socket.h>
+#include <sys/stat.h>
 #include <sys/un.h>
 #include <errno.h>
 #include <stdio.h>
@@ -43,7 +44,8 @@
  * which lives at a well-known position in the /tmp directory.
  * At some point, it will make sense to switch to something dbus-based.
  */
-#define GDM_SOCKET_FILENAME "/tmp/.gdm_socket"
+#define GDM_NEW_SOCKET_FILENAME "/var/run/gdm_socket"
+#define GDM_OLD_SOCKET_FILENAME "/tmp/.gdm_socket"
 
 /* The old gdmcomm routines used to have individual minimum versions
  * for every particular GDM command, but then you have to deal with
@@ -96,7 +98,7 @@
 
 /* The actual queue of instructions. */
 static GQueue *gdm_queue = NULL;
-/* The file descriptor of socket open on GDM_SOCKET_FILENAME. */
+/* The file descriptor of socket open on GDM_*_SOCKET_FILENAME. */
 static int gdm_socket = 0;
 /* The status, as described above. */
 static GdmSocketStatus gdm_socket_status = GDM_SOCKET_CLOSED;
@@ -228,10 +230,18 @@
     case GDM_SOCKET_CLOSED:
         {
         struct sockaddr_un addr;
+        struct stat file_stat;
 
         /* Okay, so open the socket and let's try talking to gdm. */
         gdm_socket = socket (PF_LOCAL, SOCK_STREAM, 0);
-        strcpy (addr.sun_path, GDM_SOCKET_FILENAME);
+
+        if (stat (GDM_NEW_SOCKET_FILENAME, &file_stat) == 0)
+          strcpy (addr.sun_path, GDM_NEW_SOCKET_FILENAME);
+        if (stat (GDM_OLD_SOCKET_FILENAME, &file_stat) == 0)
+          strcpy (addr.sun_path, GDM_OLD_SOCKET_FILENAME);
+        else
+          g_error ("Can't find gdm socket!");
+
         addr.sun_family = AF_UNIX;
 
         if (fcntl (gdm_socket, F_SETFL, O_NONBLOCK) < 0) {
