From c0b3a0b5621bf7bb9091fd097ddcb3257788ade4 Mon Sep 17 00:00:00 2001 From: Mike Blumenkrantz Date: Fri, 2 Feb 2018 16:59:56 -0500 Subject: [PATCH] quicklaunch: use XDG_RUNTIME_DIR instead of hardcoded /tmp --- src/bin/elementary/quicklaunch.c | 7 +++++-- src/bin/elementary/run.c | 5 ++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/bin/elementary/quicklaunch.c b/src/bin/elementary/quicklaunch.c index 6370f6d683..eb376ee216 100644 --- a/src/bin/elementary/quicklaunch.c +++ b/src/bin/elementary/quicklaunch.c @@ -182,6 +182,7 @@ main(int argc, char **argv) char buf[PATH_MAX]; struct sigaction action; const char *domain; + char *rundir; int ret = 0; if (!eina_init()) @@ -203,7 +204,9 @@ main(int argc, char **argv) if (!domain) domain = getenv("DISPLAY"); if (!domain) domain = "unknown"; } - snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i", getuid()); + rundir = getenv("XDG_RUNTIME_DIR"); + if (!rundir) rundir = "/tmp"; + snprintf(buf, sizeof(buf), "%s/elm-ql-%i", rundir, getuid()); if (stat(buf, &st) < 0) { ret = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); @@ -213,7 +216,7 @@ main(int argc, char **argv) exit(-1); } } - snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), domain); + snprintf(buf, sizeof(buf), "%s/elm-ql-%i/%s", rundir, getuid(), domain); unlink(buf); sock = socket(AF_UNIX, SOCK_STREAM, 0); if (sock < 0) diff --git a/src/bin/elementary/run.c b/src/bin/elementary/run.c index 6d547ad16a..41f666f373 100644 --- a/src/bin/elementary/run.c +++ b/src/bin/elementary/run.c @@ -34,6 +34,7 @@ main(int argc, char **argv) int we_are_elementary_run = 0; char *domain; char *cwd; + char *rundir; int sargc, slen, envnum; unsigned char *sbuf = NULL, *pos; @@ -51,7 +52,9 @@ main(int argc, char **argv) if (!domain) domain = getenv("DISPLAY"); if (!domain) domain = "unknown"; } - snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), domain); + rundir = getenv("XDG_RUNTIME_DIR"); + if (!rundir) rundir = "/tmp"; + snprintf(buf, sizeof(buf), "%s/elm-ql-%i/%s", rundir, getuid(), domain); if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) { perror("elementary_quicklaunch: socket(AF_UNIX, SOCK_STREAM, 0)");