From 4f609dbf5e18a6c8af24753372ac3aa3dc23a3ec Mon Sep 17 00:00:00 2001 From: "Jasper St. Pierre" Date: Wed, 2 Apr 2014 13:04:18 -0400 Subject: [PATCH] xwayland: Don't use glib after forking glib doesn't have any guarantee about working after forking. We can get away with it, but we're better off just not using it. --- src/wayland/meta-xwayland.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c index cfef99e76..8527519e0 100644 --- a/src/wayland/meta-xwayland.c +++ b/src/wayland/meta-xwayland.c @@ -352,7 +352,6 @@ meta_xwayland_start (MetaXWaylandManager *manager, { int sp[2]; int fd; - char *socket_fd; if (!choose_xdisplay (manager)) return FALSE; @@ -373,15 +372,16 @@ meta_xwayland_start (MetaXWaylandManager *manager, manager->pid = fork (); if (manager->pid == 0) { + char socket_fd[8]; + /* We passed SOCK_CLOEXEC, so dup the FD so it isn't * closed on exec.. */ fd = dup (sp[1]); - socket_fd = g_strdup_printf ("%d", fd); + snprintf (socket_fd, sizeof (socket_fd), "%d", fd); setenv ("WAYLAND_SOCKET", socket_fd, TRUE); - g_free (socket_fd); /* xwayland, please. */ - if (g_getenv ("XWAYLAND_STFU")) + if (getenv ("XWAYLAND_STFU")) { int dev_null; dev_null = open ("/dev/null", O_WRONLY);