Store Xorg lock files and sockets in different directories

This patch allow easy enable isolation of multiple Xorg servers and clients
running on same machine, instead of using the convention to store sockets and
lock files in /tmp/ store them in a directory defined in XORG_LOCK_DIR
environment variable.
When this environment variable is not set, fallbacks to the traditional
behavior of using /tmp/ .

--- xorg-server-1.9.3/os/utils.c.old	2012-03-29 18:20:02.000000000 +0200
+++ xorg-server-1.9.3/os/utils.c	2012-03-29 18:39:33.000000000 +0200
@@ -226,7 +226,26 @@ OsSignal(int sig, OsSigHandlerPtr handle
  * server at a time.  This keeps the servers from stomping on each other
  * if the user forgets to give them different display numbers.
  */
-#define LOCK_DIR "/tmp"
+char *
+getcompatibleenv(const char *name, const char *compatible)
+{
+  static char path_list[1][PATH_MAX];
+  char *dir;
+
+  if (path_list[0][0]) {
+    return path_list[0];
+  }
+
+  dir = getenv(name);
+  if (dir == NULL) {
+    return strncpy(path_list[0], compatible, PATH_MAX);
+  } else {
+    return strncpy(path_list[0], dir, PATH_MAX);
+  }
+
+}
+
+#define LOCK_DIR getcompatibleenv("XORG_LOCK_DIR", "/tmp")
 #define LOCK_TMP_PREFIX "/.tX"
 #define LOCK_PREFIX "/.X"
 #define LOCK_SUFFIX "-lock"
