Index: src/gdm-queue.c
===================================================================
--- src/gdm-queue.c (révision 429)
+++ src/gdm-queue.c (copie de travail)
@@ -29,7 +29,6 @@
 #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>
@@ -41,11 +40,12 @@
 /* You might have thought that we communicated with GDM using dbus or
  * bonobo or something spiffy like that. You'd be wrong! Instead, we
  * use a text-based command-response protocol over a Unix domain socket
- * which lives at a well-known position in the /tmp directory.
+ * which lives at a well-known position; this position will change in
+ * newer GDM versions, so we check for a list.
  * At some point, it will make sense to switch to something dbus-based.
  */
-#define GDM_NEW_SOCKET_FILENAME "/var/run/gdm_socket"
-#define GDM_OLD_SOCKET_FILENAME "/tmp/.gdm_socket"
+#define GDM_SOCKET_PATH "/var/run/gdm_socket" \
+    G_SEARCHPATH_SEPARATOR_S "/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
@@ -230,17 +230,28 @@ gboolean gdm_run_queue (void *dummy)
     case GDM_SOCKET_CLOSED:
         {
         struct sockaddr_un addr;
-        struct stat file_stat;
+        gchar ** socket_pathnames;
+        int i = 0;
 
         /* Okay, so open the socket and let's try talking to gdm. */
         gdm_socket = socket (PF_LOCAL, SOCK_STREAM, 0);
 
-        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!");
+        /* search the GDM_SOCKET_PATH for an existing socket pathname */
+        socket_pathnames = g_strsplit(GDM_SOCKET_PATH,
+                                      G_SEARCHPATH_SEPARATOR_S,
+                                      0);
+        while (socket_pathnames[i]) {
+            if (g_file_test(socket_pathnames[i], G_FILE_TEST_EXISTS)) {
+                strcpy (addr.sun_path, socket_pathnames[i]);
+                break;
+            }
+
+            i++;
+        }
+        if (NULL == socket_pathnames[i]) {
+            g_error ("Can't find gdm socket!");
+        }
+        g_strfreev(socket_pathnames);
 
         addr.sun_family = AF_UNIX;
 
