diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-03-13 00:59:28 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-03-13 00:59:28 +0100 |
commit | e11ca7cc0021a271709a2a90698bea42378a78af (patch) | |
tree | c2db156ad686bfed3020e998a8f6c7ee5e58c259 | |
parent | df395f32e511a7c68e168f995a27a0706636d08b (diff) | |
download | xK-e11ca7cc0021a271709a2a90698bea42378a78af.tar.gz xK-e11ca7cc0021a271709a2a90698bea42378a78af.tar.xz xK-e11ca7cc0021a271709a2a90698bea42378a78af.zip |
Use TMPDIR as a fallback if set
-rw-r--r-- | common.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -77,8 +77,11 @@ resolve_relative_runtime_unique_filename (const char *filename) str_init (&path); const char *runtime_dir = getenv ("XDG_RUNTIME_DIR"); + const char *tmpdir = getenv ("TMPDIR"); if (runtime_dir && *runtime_dir == '/') str_append (&path, runtime_dir); + else if (tmpdir && *tmpdir == '/') + str_append (&path, tmpdir); else str_append (&path, "/tmp"); str_append_printf (&path, "/%s/%s", PROGRAM_NAME, filename); |