From e9c24364b1cbec9a4d2c9a94a326cb6b8f7e6c12 Mon Sep 17 00:00:00 2001
From: chee <[email protected]>
Date: Tue, 10 May 2016 15:04:09 +0100
Subject: [PATCH] Allow users to set a directory for LOCK_DIR with an
 environment variable

This allows a user to set a directory other than /tmp for lock files to
be placed in.

Signed-off-by: chee <[email protected]>
---
 os/utils.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/os/utils.c b/os/utils.c
index e48d9f8..012e67b 100644
--- a/os/utils.c
+++ b/os/utils.c
@@ -268,7 +268,12 @@ LockServer(void)
 {
     char tmp[PATH_MAX], pid_str[12];
     int lfd, i, haslock, l_pid, t;
-    const char *tmppath = LOCK_DIR;
+    const char *tmppath;
+    if (getenv("TMPPATH") != NULL) {
+      tmppath = getenv("TMPPATH");
+    } else {
+      tmppath = LOCK_DIR;
+    }
     int len;
     char port[20];
 
-- 
2.8.2

_______________________________________________
[email protected]: X.Org development
Archives: http://lists.x.org/archives/xorg-devel
Info: https://lists.x.org/mailman/listinfo/xorg-devel

Reply via email to