Try getting TMPDIR first master
authorRobert Pengelly <robertapengelly@hotmail.com>
Mon, 13 Oct 2025 03:32:04 +0000 (04:32 +0100)
committerRobert Pengelly <robertapengelly@hotmail.com>
Mon, 13 Oct 2025 03:32:04 +0000 (04:32 +0100)
lib.c

diff --git a/lib.c b/lib.c
index fa03cc43971386df9c1eec56de95926b3861152e..af41105291fadc584435bbb3c354f6eb9dbb5b95 100644 (file)
--- a/lib.c
+++ b/lib.c
@@ -273,9 +273,13 @@ void *xrealloc (void *__ptr, unsigned long __size) {
 #if     defined (unix) || defined (__unix) || defined (__unix__) || defined (__APPLE__)
 FILE *get_temp_file (void) {
 
-    char *temp_path = "/tmp", *template;
+    char *temp_path, *template;
     int fd;
     
+    if (!(temp_path = getenv ("TMPDIR"))) {
+        temp_path = "/tmp";
+    }
+    
     template = xmalloc (strlen (temp_path) + 1 + 10 + 1);
     sprintf (template, "%s/sarXXXXXX", temp_path);