summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Schmidt <s.schmidt@samsung.com>2014-09-11 10:45:54 +0200
committerStefan Schmidt <s.schmidt@samsung.com>2014-09-11 11:21:09 +0200
commit5f6944cf1fc7309dbaa451695bedc358664e9b7d (patch)
tree6970e9229a181125c9123a19dd96e1f686d06866
parent091376c1ebdf4a4dc97a7039e9de0801cce39506 (diff)
downloadefl-devs/stefan/xdg-runtime-dir-for-mkstemp.tar.gz
eina_file: Try to use XDG_RUNTIME_DIR for tmp dir firstdevs/stefan/xdg-runtime-dir-for-mkstemp
Instead using $TMPDIR and following back to /tmp we now try $XDG_RUNTIME_DIR first. "$XDG_RUNTIME_DIR defines the base directory relative to which user-specific non-essential runtime files and other file objects (such as sockets, named pipes, ...) should be stored. The directory MUST be owned by the user, and he MUST be the only one having read and write access to it. Its Unix access mode MUST be 0700." While improving our security by isolating these files from other users this has the potential to break things. I have not seen any breakage in testing but keep this commit in mind if something strange happens on your system.
-rw-r--r--src/lib/eina/eina_file_common.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/lib/eina/eina_file_common.c b/src/lib/eina/eina_file_common.c
index 9b2539b3ac..9c9e9afe6b 100644
--- a/src/lib/eina/eina_file_common.c
+++ b/src/lib/eina/eina_file_common.c
@@ -906,7 +906,8 @@ eina_file_mkstemp(const char *templatename, Eina_Tmpstr **path)
#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
if (getuid() == geteuid())
#endif
- tmpdir = getenv("TMPDIR");
+ tmpdir = getenv("XDG_RUNTIME_DIR");
+ if (!tmpdir) tmpdir = getenv("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
#else
tmpdir = (char *)evil_tmpdir_get();