diff options
author | Pekka Paalanen <ppaalanen@gmail.com> | 2012-06-06 14:30:19 +0300 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-06-06 13:07:33 -0400 |
commit | c29020332a7bb56cb9e5c5928ed9a5a2e80b2bef (patch) | |
tree | aa8745183b0396f86063d0c619a8c2d657187e9c | |
parent | 0c7ca38c7f8b3da5b3dfa44064fe994c80849b71 (diff) |
server: require XDG_RUNTIME_DIR
An arbitrary fallback to the current directory is only confusing.
Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
-rw-r--r-- | src/wayland-server.c | 17 |
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) |