Blob Blame Raw
From 98ef41d4b468b4651d221e300d171bd1f8ebf72d Mon Sep 17 00:00:00 2001
From: Dave Love <dave.love@manchester.ac.uk>
Date: Mon, 15 May 2017 00:07:55 +0100
Subject: [PATCH 23/30] Use TMPDIR

---
 src/lib/sessiondir.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/lib/sessiondir.c b/src/lib/sessiondir.c
index d1d2821b..c886ec43 100644
--- a/src/lib/sessiondir.c
+++ b/src/lib/sessiondir.c
@@ -77,7 +77,9 @@ char *singularity_sessiondir_init(char *file) {
                 ABORT(255);
             }
         } else {
-            snprintf(sessiondir, sizeof(char) * PATH_MAX, "/tmp/.singularity-session-%d.%d.%lu", (int)uid, (int)filestat.st_dev, (long unsigned)filestat.st_ino); // Flawfinder: ignore
+            char *tmp = getenv("TMPDIR");
+            if (!tmp) tmp = "/tmp";
+            snprintf(sessiondir, sizeof(char) * PATH_MAX, "%s/.singularity-session-%d.%d.%lu", tmp, (int)uid, (int)filestat.st_dev, (long unsigned)filestat.st_ino); // Flawfinder: ignore
         }
         singularity_message(DEBUG, "Set sessiondir to: %s\n", sessiondir);
         free(sessiondir_prefix);
-- 
2.11.0
From 29cdb492fc5e805a20b607e63687b9aebedcc8b6 Mon Sep 17 00:00:00 2001
From: Dave Love <dave.love@manchester.ac.uk>
Date: Mon, 15 May 2017 11:05:14 +0100
Subject: [PATCH 26/30] Use envar_path

---
 src/lib/sessiondir.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/lib/sessiondir.c b/src/lib/sessiondir.c
index c886ec43..d9b64404 100644
--- a/src/lib/sessiondir.c
+++ b/src/lib/sessiondir.c
@@ -77,7 +77,7 @@ char *singularity_sessiondir_init(char *file) {
                 ABORT(255);
             }
         } else {
-            char *tmp = getenv("TMPDIR");
+            char *tmp = envar_path("TMPDIR");
             if (!tmp) tmp = "/tmp";
             snprintf(sessiondir, sizeof(char) * PATH_MAX, "%s/.singularity-session-%d.%d.%lu", tmp, (int)uid, (int)filestat.st_dev, (long unsigned)filestat.st_ino); // Flawfinder: ignore
         }
-- 
2.11.0