[mutter/wip/wayland-display: 50/55] MetaWayland: don't lose the xwayland standard error



commit a702ba19448ccb777ce8b1ab7f0324b66fc1043e
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Mon Jul 29 10:58:56 2013 +0200

    MetaWayland: don't lose the xwayland standard error
    
    This way it's possible to debug wayland protocol errors
    with WAYLAND_DEBUG.

 src/wayland/meta-wayland.c |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)
---
diff --git a/src/wayland/meta-wayland.c b/src/wayland/meta-wayland.c
index 4506132..fd9371e 100644
--- a/src/wayland/meta-wayland.c
+++ b/src/wayland/meta-wayland.c
@@ -1377,6 +1377,7 @@ bind_to_unix_socket (int display)
 static void
 uncloexec_and_setpgid (gpointer user_data)
 {
+  char path[PATH_MAX];
   int fd = GPOINTER_TO_INT (user_data);
 
   /* Make sure the client end of the socket pair doesn't get closed
@@ -1388,6 +1389,16 @@ uncloexec_and_setpgid (gpointer user_data)
   /* Put this process in a background process group, so that Ctrl-C
      goes to mutter only */
   setpgid (0, 0);
+
+  /* Open a log in the home directory */
+  snprintf(path, PATH_MAX, "%s/xwayland-stderr.log", g_get_user_cache_dir ());
+  fd = open (path, O_WRONLY | O_APPEND | O_CREAT | O_TRUNC, 0600);
+  if (fd < 0)
+    return;
+
+  dup2 (fd, STDOUT_FILENO);
+  dup2 (fd, STDERR_FILENO);
+  close (fd);
 }
 
 static void


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]