diff --git a/doc/man/wl_display_connect.xml b/doc/man/wl_display_connect.xml
index 7e6e05c6..ded3cbd3 100644
--- a/doc/man/wl_display_connect.xml
+++ b/doc/man/wl_display_connect.xml
@@ -57,9 +57,8 @@
that was previously opened by a Wayland server. The server socket must
be placed in XDG_RUNTIME_DIR for this function to
find it. The name argument specifies the name of
- the socket or NULL to use the default (which is
- "wayland-0"). The environment variable
- WAYLAND_DISPLAY replaces the default value. If
+ the socket or NULL to use the default
+ (which is the value of WAYLAND_DISPLAY). If
WAYLAND_SOCKET is set, this function behaves like
wl_display_connect_to_fd with the file-descriptor
number taken from the environment variable.
diff --git a/doc/publican/sources/Protocol.xml b/doc/publican/sources/Protocol.xml
index 477063be..9464953b 100644
--- a/doc/publican/sources/Protocol.xml
+++ b/doc/publican/sources/Protocol.xml
@@ -60,10 +60,10 @@
Wire Format
The protocol is sent over a UNIX domain stream socket, where the endpoint
- usually is named wayland-0
- (although it can be changed via WAYLAND_DISPLAY
- in the environment). The protocol is message-based. A
- message sent by a client to the server is called request. A message
+ name is determined by the WAYLAND_DISPLAY
+ environment variable. Its value will usually be
+ wayland-0. The protocol is message-based.
+ A message sent by a client to the server is called request. A message
from the server to a client is called event. Every message is
structured as 32-bit words, values are represented in the host's
byte-order.
diff --git a/src/wayland-client.c b/src/wayland-client.c
index 09c594ae..ffbca4b0 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -764,8 +764,11 @@ connect_to_socket(const char *name)
if (name == NULL)
name = getenv("WAYLAND_DISPLAY");
- if (name == NULL)
- name = "wayland-0";
+ if (name == NULL) {
+ wl_log("error: WAYLAND_DISPLAY not set in the environment.\n");
+ errno = ENOENT;
+ return -1;
+ }
fd = wl_os_socket_cloexec(PF_LOCAL, SOCK_STREAM, 0);
if (fd < 0)
@@ -869,8 +872,7 @@ wl_display_connect_to_fd(int fd)
* \return A \ref wl_display object or \c NULL on failure
*
* Connect to the Wayland display named \c name. If \c name is \c NULL,
- * its value will be replaced with the WAYLAND_DISPLAY environment
- * variable if it is set, otherwise display "wayland-0" will be used.
+ * its value will be replaced with the WAYLAND_DISPLAY environment variable.
*
* \memberof wl_display
*/