summaryrefslogtreecommitdiff
path: root/src/wayland-client.c
diff options
context:
space:
mode:
authorPekka Paalanen <ppaalanen@gmail.com>2012-06-06 14:30:18 +0300
committerKristian Høgsberg <krh@bitplanet.net>2012-06-06 13:07:25 -0400
commit0c7ca38c7f8b3da5b3dfa44064fe994c80849b71 (patch)
tree8ecb76bae7bd76b3505244a7fb241a07bf945e61 /src/wayland-client.c
parentaa792ad3d657853a24faa5a6d5ae09830490087f (diff)
client: require XDG_RUNTIME_DIR
An arbitrary fallback to the current directory is only confusing. Signed-off-by: Pekka Paalanen <ppaalanen@gmail.com>
Diffstat (limited to 'src/wayland-client.c')
-rw-r--r--src/wayland-client.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index ecedd99..bba972e 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -308,16 +308,15 @@ connect_to_socket(struct wl_display *display, const char *name)
const char *runtime_dir;
size_t name_size;
- display->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
- if (display->fd < 0)
- return -1;
-
runtime_dir = getenv("XDG_RUNTIME_DIR");
- if (runtime_dir == NULL) {
- runtime_dir = ".";
+ if (!runtime_dir) {
fprintf(stderr,
- "XDG_RUNTIME_DIR not set, falling back to %s\n",
- runtime_dir);
+ "error: XDG_RUNTIME_DIR not set in the environment.\n");
+
+ /* to prevent programs reporting
+ * "failed to create display: Success" */
+ errno = ENOENT;
+ return -1;
}
if (name == NULL)
@@ -325,6 +324,10 @@ connect_to_socket(struct wl_display *display, const char *name)
if (name == NULL)
name = "wayland-0";
+ display->fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
+ if (display->fd < 0)
+ return -1;
+
memset(&addr, 0, sizeof addr);
addr.sun_family = AF_LOCAL;
name_size =