summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Blumenkrantz <zmike@osg.samsung.com>2018-02-02 16:59:56 -0500
committerMike Blumenkrantz <zmike@osg.samsung.com>2018-02-02 16:59:44 -0500
commitc0b3a0b5621bf7bb9091fd097ddcb3257788ade4 (patch)
treef05f7654a85fb4c0bf2a5d350102ac536326faed
parent7f0a4154f57ea76f5d69cc988276d0db7144985c (diff)
quicklaunch: use XDG_RUNTIME_DIR instead of hardcoded /tmp
-rw-r--r--src/bin/elementary/quicklaunch.c7
-rw-r--r--src/bin/elementary/run.c5
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)
182 char buf[PATH_MAX]; 182 char buf[PATH_MAX];
183 struct sigaction action; 183 struct sigaction action;
184 const char *domain; 184 const char *domain;
185 char *rundir;
185 int ret = 0; 186 int ret = 0;
186 187
187 if (!eina_init()) 188 if (!eina_init())
@@ -203,7 +204,9 @@ main(int argc, char **argv)
203 if (!domain) domain = getenv("DISPLAY"); 204 if (!domain) domain = getenv("DISPLAY");
204 if (!domain) domain = "unknown"; 205 if (!domain) domain = "unknown";
205 } 206 }
206 snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i", getuid()); 207 rundir = getenv("XDG_RUNTIME_DIR");
208 if (!rundir) rundir = "/tmp";
209 snprintf(buf, sizeof(buf), "%s/elm-ql-%i", rundir, getuid());
207 if (stat(buf, &st) < 0) 210 if (stat(buf, &st) < 0)
208 { 211 {
209 ret = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR); 212 ret = mkdir(buf, S_IRUSR | S_IWUSR | S_IXUSR);
@@ -213,7 +216,7 @@ main(int argc, char **argv)
213 exit(-1); 216 exit(-1);
214 } 217 }
215 } 218 }
216 snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), domain); 219 snprintf(buf, sizeof(buf), "%s/elm-ql-%i/%s", rundir, getuid(), domain);
217 unlink(buf); 220 unlink(buf);
218 sock = socket(AF_UNIX, SOCK_STREAM, 0); 221 sock = socket(AF_UNIX, SOCK_STREAM, 0);
219 if (sock < 0) 222 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)
34 int we_are_elementary_run = 0; 34 int we_are_elementary_run = 0;
35 char *domain; 35 char *domain;
36 char *cwd; 36 char *cwd;
37 char *rundir;
37 38
38 int sargc, slen, envnum; 39 int sargc, slen, envnum;
39 unsigned char *sbuf = NULL, *pos; 40 unsigned char *sbuf = NULL, *pos;
@@ -51,7 +52,9 @@ main(int argc, char **argv)
51 if (!domain) domain = getenv("DISPLAY"); 52 if (!domain) domain = getenv("DISPLAY");
52 if (!domain) domain = "unknown"; 53 if (!domain) domain = "unknown";
53 } 54 }
54 snprintf(buf, sizeof(buf), "/tmp/elm-ql-%i/%s", getuid(), domain); 55 rundir = getenv("XDG_RUNTIME_DIR");
56 if (!rundir) rundir = "/tmp";
57 snprintf(buf, sizeof(buf), "%s/elm-ql-%i/%s", rundir, getuid(), domain);
55 if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0) 58 if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
56 { 59 {
57 perror("elementary_quicklaunch: socket(AF_UNIX, SOCK_STREAM, 0)"); 60 perror("elementary_quicklaunch: socket(AF_UNIX, SOCK_STREAM, 0)");