summaryrefslogtreecommitdiff
path: root/src/wayland/meta-xwayland.c
diff options
context:
space:
mode:
authorRui Matos <tiagomatos@gmail.com>2014-03-25 11:59:04 +0100
committerRui Matos <tiagomatos@gmail.com>2014-03-25 14:52:57 +0100
commit7484d540cdef81d704b260e96e2d6b403b22cfd9 (patch)
tree9300b5688443e54d38c10d3c0cd668b190b8eb69 /src/wayland/meta-xwayland.c
parenta55622d924739937bcedf79212fe49b0fa09efa0 (diff)
downloadmutter-7484d540cdef81d704b260e96e2d6b403b22cfd9.tar.gz
wayland: Use an array initializer for the X server arguments
This fixes the unitialized array members introduced previously and should avoid such mistakes again going forward. https://bugzilla.gnome.org/show_bug.cgi?id=727011
Diffstat (limited to 'src/wayland/meta-xwayland.c')
-rw-r--r--src/wayland/meta-xwayland.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/src/wayland/meta-xwayland.c b/src/wayland/meta-xwayland.c
index 65288ff41..20bf59684 100644
--- a/src/wayland/meta-xwayland.c
+++ b/src/wayland/meta-xwayland.c
@@ -303,8 +303,6 @@ meta_xwayland_start (MetaXWaylandManager *manager,
pid_t pid;
char **env;
char *fd_string;
- char *args[10];
- GError *error;
wl_global_create (wl_display, &xserver_interface,
META_XSERVER_VERSION,
@@ -364,38 +362,40 @@ meta_xwayland_start (MetaXWaylandManager *manager,
manager->display_name = g_strdup_printf (":%d", manager->display_index);
- args[0] = XWAYLAND_PATH;
- args[1] = manager->display_name;
- args[2] = "-wayland";
- args[3] = "-rootless";
- args[4] = "-noreset";
- args[7] = "-nolisten";
- args[8] = "all";
- args[9] = NULL;
-
- error = NULL;
- if (g_spawn_async (NULL, /* cwd */
- args,
- env,
- G_SPAWN_LEAVE_DESCRIPTORS_OPEN |
- G_SPAWN_DO_NOT_REAP_CHILD,
- uncloexec,
- GINT_TO_POINTER (sp[1]),
- &pid,
- &error))
- {
- g_message ("forked X server, pid %d\n", pid);
-
- close (sp[1]);
- manager->client = wl_client_create (wl_display, sp[0]);
-
- manager->pid = pid;
- g_child_watch_add (pid, xserver_died, NULL);
- }
- else
- {
- g_error ("Failed to fork for xwayland server: %s", error->message);
- }
+ {
+ GError *error = NULL;
+ gchar *args[] = { XWAYLAND_PATH,
+ manager->display_name,
+ "-wayland",
+ "-rootless",
+ "-noreset",
+ "-nolisten",
+ "all",
+ NULL };
+
+ if (g_spawn_async (NULL, /* cwd */
+ args,
+ env,
+ G_SPAWN_LEAVE_DESCRIPTORS_OPEN |
+ G_SPAWN_DO_NOT_REAP_CHILD,
+ uncloexec,
+ GINT_TO_POINTER (sp[1]),
+ &pid,
+ &error))
+ {
+ g_message ("forked X server, pid %d\n", pid);
+
+ close (sp[1]);
+ manager->client = wl_client_create (wl_display, sp[0]);
+
+ manager->pid = pid;
+ g_child_watch_add (pid, xserver_died, NULL);
+ }
+ else
+ {
+ g_error ("Failed to fork for xwayland server: %s", error->message);
+ }
+ }
g_strfreev (env);