efreet: Create a temp XDG_RUNTIME_DIR if not set

Using /tmp as XDG_RUNTIME_DIR is pointless if we want it to be mode 0700
This commit is contained in:
Sebastian Dransfeld 2013-06-20 13:27:20 +02:00
parent 068f1ddc62
commit b1c97a0da4
1 changed files with 13 additions and 1 deletions

View File

@ -303,7 +303,19 @@ efreet_dirs_init(void)
xdg_config_dirs = efreet_dirs_get("XDG_CONFIG_DIRS", "/etc/xdg");
/* xdg_runtime_dir */
xdg_runtime_dir = efreet_dir_get("XDG_RUNTIME_DIR", "/tmp");
xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
if (!xdg_runtime_dir)
{
snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
xdg_runtime_dir = mkdtemp(buf);
if (!xdg_runtime_dir)
{
perror("efreet mkdtemp");
xdg_runtime_dir = "/tmp";
}
}
xdg_runtime_dir = eina_stringshare_add(xdg_runtime_dir);
if (stat(xdg_runtime_dir, &st) == -1)
{
ERR("$XDG_RUNTIME_DIR did not exist, creating '%s' (breaks spec)",