summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wayland-server.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/wayland-server.c b/src/wayland-server.c
index ed9f001..fb4e157 100644
--- a/src/wayland-server.c
+++ b/src/wayland-server.c
@@ -1091,6 +1091,16 @@ wl_display_add_socket(struct wl_display *display, const char *name)
socklen_t size, name_size;
const char *runtime_dir;
+ runtime_dir = getenv("XDG_RUNTIME_DIR");
+ if (!runtime_dir) {
+ wl_log("error: XDG_RUNTIME_DIR not set in the environment\n");
+
+ /* to prevent programs reporting
+ * "failed to add socket: Success" */
+ errno = ENOENT;
+ return -1;
+ }
+
s = malloc(sizeof *s);
if (s == NULL)
return -1;
@@ -1101,13 +1111,6 @@ wl_display_add_socket(struct wl_display *display, const char *name)
return -1;
}
- runtime_dir = getenv("XDG_RUNTIME_DIR");
- if (runtime_dir == NULL) {
- runtime_dir = ".";
- wl_log("XDG_RUNTIME_DIR not set, falling back to %s\n",
- runtime_dir);
- }
-
if (name == NULL)
name = getenv("WAYLAND_DISPLAY");
if (name == NULL)