[PATCH] client: unset WAYLAND_SOCKET env variable

Pekka Paalanen ppaalanen at gmail.com
Mon Dec 5 00:04:37 PST 2011

WAYLAND_SOCKET contains a file descriptor that is an open connection to
a Wayland server. It is private to us, and makes no sense to relay the
same value (or any value) to our child processes.

Unset the environment variable to prevent it from being accidentally
relayed to other processes.

Signed-off-by: Pekka Paalanen <ppaalanen at gmail.com>
 src/wayland-client.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)

diff --git a/src/wayland-client.c b/src/wayland-client.c
index 939c17d..22244f8 100644
--- a/src/wayland-client.c
+++ b/src/wayland-client.c
@@ -352,6 +352,7 @@ wl_display_connect(const char *name)
 		flags = fcntl(display->fd, F_GETFD);
 		if (flags != -1)
 			fcntl(display->fd, F_SETFD, flags | FD_CLOEXEC);
+		unsetenv("WAYLAND_SOCKET");
 	} else if (connect_to_socket(display, name) < 0) {
 		return NULL;

More information about the wayland-devel mailing list