summaryrefslogtreecommitdiff
path: root/src/lib/efreet
diff options
context:
space:
mode:
authorSebastian Dransfeld <sd@tango.flipp.net>2014-08-14 13:00:28 +0200
committerSebastian Dransfeld <sd@tango.flipp.net>2014-08-14 13:01:29 +0200
commit95a02295c1c4ab547cd34f82a284c9a6dfa255be (patch)
tree4ead1fec9ee21b1e4e610718141f2d6a28371f84 /src/lib/efreet
parent03f7ff5f27fbdd918c4e5d133175dba44259de03 (diff)
efreet: remove creation of XDG_RUNTIME_DIR
XDG_RUNTIME_DIR should be created and set by the system, not a library.
Diffstat (limited to 'src/lib/efreet')
-rw-r--r--src/lib/efreet/efreet_base.c54
1 files changed, 0 insertions, 54 deletions
diff --git a/src/lib/efreet/efreet_base.c b/src/lib/efreet/efreet_base.c
index 276252a537..20c248b6ab 100644
--- a/src/lib/efreet/efreet_base.c
+++ b/src/lib/efreet/efreet_base.c
@@ -92,7 +92,6 @@ efreet_base_shutdown(void)
92 IF_RELEASE(xdg_data_home); 92 IF_RELEASE(xdg_data_home);
93 IF_RELEASE(xdg_config_home); 93 IF_RELEASE(xdg_config_home);
94 IF_RELEASE(xdg_cache_home); 94 IF_RELEASE(xdg_cache_home);
95 IF_RELEASE(xdg_runtime_dir);
96 95
97 IF_FREE_LIST(xdg_data_dirs, eina_stringshare_del); 96 IF_FREE_LIST(xdg_data_dirs, eina_stringshare_del);
98 IF_FREE_LIST(xdg_config_dirs, eina_stringshare_del); 97 IF_FREE_LIST(xdg_config_dirs, eina_stringshare_del);
@@ -275,7 +274,6 @@ static void
275efreet_dirs_init(void) 274efreet_dirs_init(void)
276{ 275{
277 char buf[4096]; 276 char buf[4096];
278 struct stat st;
279 277
280 /* efreet_home_dir */ 278 /* efreet_home_dir */
281#if defined(HAVE_GETUID) && defined(HAVE_GETEUID) 279#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
@@ -325,59 +323,7 @@ efreet_dirs_init(void)
325 if (getuid() == geteuid()) 323 if (getuid() == geteuid())
326#endif 324#endif
327 xdg_runtime_dir = getenv("XDG_RUNTIME_DIR"); 325 xdg_runtime_dir = getenv("XDG_RUNTIME_DIR");
328 if (!xdg_runtime_dir)
329 {
330 snprintf(buf, sizeof(buf), "/tmp/xdg-XXXXXX");
331 xdg_runtime_dir = mkdtemp(buf);
332 if (!xdg_runtime_dir)
333 {
334 perror("efreet mkdtemp");
335 xdg_runtime_dir = "/tmp";
336 }
337 }
338 xdg_runtime_dir = eina_stringshare_add(xdg_runtime_dir);
339 326
340 if (stat(xdg_runtime_dir, &st) == -1)
341 {
342 ERR("$XDG_RUNTIME_DIR did not exist, creating '%s' (breaks spec)",
343 xdg_runtime_dir);
344 if (ecore_file_mkpath(xdg_runtime_dir))
345 {
346 if (chmod(xdg_runtime_dir, 0700) < 0)
347 {
348 CRI("Cannot set XDG_RUNTIME_DIR=%s to mode 0700: %s",
349 xdg_runtime_dir, strerror(errno));
350 eina_stringshare_replace(&xdg_runtime_dir, NULL);
351 }
352 }
353 else
354 {
355 CRI("Failed to create XDG_RUNTIME_DIR=%s", xdg_runtime_dir);
356 eina_stringshare_replace(&xdg_runtime_dir, NULL);
357 }
358 }
359 else if (!S_ISDIR(st.st_mode))
360 {
361 CRI("XDG_RUNTIME_DIR=%s is not a directory!", xdg_runtime_dir);
362 eina_stringshare_replace(&xdg_runtime_dir, NULL);
363 }
364 else if ((st.st_mode & 0777) != 0700)
365 {
366#ifdef HAVE_GETEUID
367 if ((!(!strcmp(xdg_runtime_dir, "/tmp"))) &&
368 (st.st_uid == geteuid()))
369 {
370 ERR("XDG_RUNTIME_DIR=%s is mode %o, changing to 0700",
371 xdg_runtime_dir, st.st_mode & 0777);
372 if (chmod(xdg_runtime_dir, 0700) != 0)
373 {
374 CRI("Cannot fix XDG_RUNTIME_DIR=%s incorrect mode %o: %s",
375 xdg_runtime_dir, st.st_mode & 0777, strerror(errno));
376 eina_stringshare_replace(&xdg_runtime_dir, NULL);
377 }
378 }
379#endif
380 }
381 /* hostname */ 327 /* hostname */
382 if (gethostname(buf, sizeof(buf)) < 0) 328 if (gethostname(buf, sizeof(buf)) < 0)
383 hostname = eina_stringshare_add(""); 329 hostname = eina_stringshare_add("");