e: 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:29:37 +02:00
parent 6f2ce10eb1
commit dd27589470
1 changed files with 9 additions and 1 deletions

View File

@ -151,7 +151,15 @@ _xdg_data_dirs_augment(void)
}
if (!getenv("XDG_RUNTIME_DIR"))
e_util_env_set("XDG_RUNTIME_DIR", "/tmp");
{
char buf[PATH_MAX];
const char *dir;
snprintf(buf, sizeof(buf), "/tmp/xdg_runtime_XXXXXX");
dir = mkdtemp(buf);
if (!dir) dir = "/tmp";
e_util_env_set("XDG_RUNTIME_DIR", dir);
}
}
static void