eina_file: Try to use XDG_RUNTIME_DIR for tmp dir first

Instead using $TMPDIR and falling 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.
This commit is contained in:
Stefan Schmidt 2014-09-11 10:45:54 +02:00
parent e3a4da57b2
commit 61478af3a6
1 changed files with 2 additions and 1 deletions

View File

@ -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();