[PATCH weston 2/2] compositor: don't abort if XDG_RUNTIME_DIR is not set

Emilio Pozuelo Monfort pochu27 at gmail.com
Mon Mar 11 09:10:59 PDT 2013


The XDG base directory specification says that if
XDG_RUNTIME_DIR is not set, one should print a warning
and fall back to another directory.

https://bugs.freedesktop.org/show_bug.cgi?id=62092
---
 src/compositor.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/compositor.c b/src/compositor.c
index a2860fd..c615eec 100644
--- a/src/compositor.c
+++ b/src/compositor.c
@@ -3305,7 +3305,8 @@ load_modules(struct weston_compositor *ec, const char *modules,
 }
 
 static const char xdg_error_message[] =
-	"fatal: environment variable XDG_RUNTIME_DIR is not set.\n";
+	"warning: environment variable XDG_RUNTIME_DIR is not set,\n"
+	"falling back to ~/.cache.\n";
 
 static const char xdg_wrong_message[] =
 	"fatal: environment variable XDG_RUNTIME_DIR\n"
@@ -3331,7 +3332,9 @@ verify_xdg_runtime_dir(void)
 	if (!dir) {
 		weston_log(xdg_error_message);
 		weston_log_continue(xdg_detail_message);
-		exit(EXIT_FAILURE);
+
+		/* don't abort, fall back to ~/.cache instead */
+		return;
 	}
 
 	if (stat(dir, &s) || !S_ISDIR(s.st_mode)) {
-- 
1.7.10.4



More information about the wayland-devel mailing list