summaryrefslogtreecommitdiff
path: root/legacy/efreet
diff options
context:
space:
mode:
authorGustavo Sverzut Barbieri <barbieri@gmail.com>2012-10-09 20:12:02 +0000
committerGustavo Sverzut Barbieri <barbieri@gmail.com>2012-10-09 20:12:02 +0000
commit7869bcc670ed8a4935319d491fdf0f8639f16852 (patch)
tree1a971f5a5d092860a2cc35d684c134da9726cf3d /legacy/efreet
parente5e90c233d5afbc05fd4b232ebb21895eddfbe56 (diff)
try to fallback on missing XDG_RUNTIME_DIR
SVN revision: 77682
Diffstat (limited to 'legacy/efreet')
-rw-r--r--legacy/efreet/src/lib/efreet_base.c32
-rw-r--r--legacy/efreet/src/lib/efreet_private.h4
2 files changed, 36 insertions, 0 deletions
diff --git a/legacy/efreet/src/lib/efreet_base.c b/legacy/efreet/src/lib/efreet_base.c
index 3b84ee0ff0..ea71bf9d6f 100644
--- a/legacy/efreet/src/lib/efreet_base.c
+++ b/legacy/efreet/src/lib/efreet_base.c
@@ -33,6 +33,8 @@ static int _efreet_base_log_dom = -1;
33#include "Efreet.h" 33#include "Efreet.h"
34#include "efreet_private.h" 34#include "efreet_private.h"
35 35
36#include <Ecore_File.h>
37
36static Efreet_Version _version = { VMAJ, VMIN, VMIC, VREV }; 38static Efreet_Version _version = { VMAJ, VMIN, VMIC, VREV };
37EAPI Efreet_Version *efreet_version = &_version; 39EAPI Efreet_Version *efreet_version = &_version;
38 40
@@ -258,8 +260,38 @@ efreet_cache_home_get(void)
258EAPI const char * 260EAPI const char *
259efreet_runtime_dir_get(void) 261efreet_runtime_dir_get(void)
260{ 262{
263 struct stat st;
261 if (xdg_runtime_dir) return xdg_runtime_dir; 264 if (xdg_runtime_dir) return xdg_runtime_dir;
262 xdg_runtime_dir = efreet_dir_get("XDG_RUNTIME_DIR", "/tmp"); 265 xdg_runtime_dir = efreet_dir_get("XDG_RUNTIME_DIR", "/tmp");
266 if (stat(xdg_runtime_dir, &st) == -1)
267 {
268 ERR("$XDG_RUNTIME_DIR did not exist, creating '%s' (breaks spec)",
269 xdg_runtime_dir);
270 if (ecore_file_mkpath(xdg_runtime_dir))
271 chmod(xdg_runtime_dir, 0700);
272 else
273 {
274 CRITICAL("Failed to create XDG_RUNTIME_DIR=%s", xdg_runtime_dir);
275 eina_stringshare_replace(&xdg_runtime_dir, NULL);
276 }
277 }
278 else if (!S_ISDIR(st.st_mode))
279 {
280 CRITICAL("XDG_RUNTIME_DIR=%s is not a directory!", xdg_runtime_dir);
281 eina_stringshare_replace(&xdg_runtime_dir, NULL);
282 }
283 else if ((st.st_mode & 0777) != 0700)
284 {
285 ERR("XDG_RUNTIME_DIR=%s is mode %o, changing to 0700",
286 xdg_runtime_dir, st.st_mode & 0777);
287 if (chmod(xdg_runtime_dir, 0700) != 0)
288 {
289 CRITICAL("Cannot fix XDG_RUNTIME_DIR=%s incorrect mode %o: %s",
290 xdg_runtime_dir, st.st_mode & 0777, strerror(errno));
291 eina_stringshare_replace(&xdg_runtime_dir, NULL);
292 }
293 }
294
263 return xdg_runtime_dir; 295 return xdg_runtime_dir;
264} 296}
265 297
diff --git a/legacy/efreet/src/lib/efreet_private.h b/legacy/efreet/src/lib/efreet_private.h
index 8705e3b49f..19ffe25ee4 100644
--- a/legacy/efreet/src/lib/efreet_private.h
+++ b/legacy/efreet/src/lib/efreet_private.h
@@ -90,6 +90,10 @@
90 * four macros are defined ERR, WRN, DGB, INF. 90 * four macros are defined ERR, WRN, DGB, INF.
91 * EFREET_MODULE_LOG_DOM should be defined individually for each module 91 * EFREET_MODULE_LOG_DOM should be defined individually for each module
92 */ 92 */
93#ifdef CRITICAL
94#undef CRITICAL
95#endif
96#define CRITICAL(...) EINA_LOG_DOM_CRIT(EFREET_MODULE_LOG_DOM, __VA_ARGS__)
93#ifdef ERR 97#ifdef ERR
94#undef ERR 98#undef ERR
95#endif 99#endif