aboutsummaryrefslogtreecommitdiffstats
path: root/src/wayland-client.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/wayland-client.c')
-rw-r--r--src/wayland-client.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/wayland-client.c b/src/wayland-client.c
index b0f77b9..01629e0 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -829,9 +829,12 @@ wl_display_connect(const char *name)
connection = getenv("WAYLAND_SOCKET");
if (connection) {
+ int prev_errno = errno;
+ errno = 0;
fd = strtol(connection, &end, 0);
- if (*end != '\0')
+ if (errno != 0 || connection == end || *end != '\0')
return NULL;
+ errno = prev_errno;
flags = fcntl(fd, F_GETFD);
if (flags != -1)