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.
This commit is contained in:
Jasper St. Pierre 2014-04-02 13:04:18 -04:00
parent 2a7d12ba14
commit 4f609dbf5e

View File

@ -352,7 +352,6 @@ meta_xwayland_start (MetaXWaylandManager *manager,
{ {
int sp[2]; int sp[2];
int fd; int fd;
char *socket_fd;
if (!choose_xdisplay (manager)) if (!choose_xdisplay (manager))
return FALSE; return FALSE;
@ -373,15 +372,16 @@ meta_xwayland_start (MetaXWaylandManager *manager,
manager->pid = fork (); manager->pid = fork ();
if (manager->pid == 0) if (manager->pid == 0)
{ {
char socket_fd[8];
/* We passed SOCK_CLOEXEC, so dup the FD so it isn't /* We passed SOCK_CLOEXEC, so dup the FD so it isn't
* closed on exec.. */ * closed on exec.. */
fd = dup (sp[1]); 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); setenv ("WAYLAND_SOCKET", socket_fd, TRUE);
g_free (socket_fd);
/* xwayland, please. */ /* xwayland, please. */
if (g_getenv ("XWAYLAND_STFU")) if (getenv ("XWAYLAND_STFU"))
{ {
int dev_null; int dev_null;
dev_null = open ("/dev/null", O_WRONLY); dev_null = open ("/dev/null", O_WRONLY);