diff options
author | Přemysl Janouch <p.janouch@gmail.com> | 2016-03-13 01:02:07 +0100 |
---|---|---|
committer | Přemysl Janouch <p.janouch@gmail.com> | 2016-03-13 01:02:07 +0100 |
commit | ed77188bfdf44b1aa8dc8af05e12bc38aecd4041 (patch) | |
tree | cf021cc58786c6e437e2492af7e0fb8c3c23149e | |
parent | e2f5cb768e3e12b7befbb10d9ce13ad1f922f7cc (diff) | |
download | json-rpc-shell-ed77188bfdf44b1aa8dc8af05e12bc38aecd4041.tar.gz json-rpc-shell-ed77188bfdf44b1aa8dc8af05e12bc38aecd4041.tar.xz json-rpc-shell-ed77188bfdf44b1aa8dc8af05e12bc38aecd4041.zip |
Use TMPDIR as a fallback if set
-rw-r--r-- | json-rpc-shell.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/json-rpc-shell.c b/json-rpc-shell.c index 0830aae..fb95ee7 100644 --- a/json-rpc-shell.c +++ b/json-rpc-shell.c @@ -3059,8 +3059,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); |