[mutter/wip/wayland-work: 22/44] mutter-launch: support spawning with stdin to /dev/null



commit 34d142eb607fd0fdaa8cbd79e6f3c319517e2b34
Author: Giovanni Campagna <gcampagn redhat com>
Date:   Tue Aug 20 15:45:08 2013 +0200

    mutter-launch: support spawning with stdin to /dev/null
    
    If we don't have stdin connected to a terminal, and we don't see
    the -t argument, assume the terminal we want is $XDG_VTNR
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705861

 src/wayland/weston-launch.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)
---
diff --git a/src/wayland/weston-launch.c b/src/wayland/weston-launch.c
index 1faeec4..a1cf72e 100644
--- a/src/wayland/weston-launch.c
+++ b/src/wayland/weston-launch.c
@@ -365,7 +365,14 @@ setup_tty(struct weston_launch *wl, const char *tty)
                else
                        wl->tty = open(tty, O_RDWR | O_NOCTTY);
        } else {
-               wl->tty = STDIN_FILENO;
+               if (isatty (STDIN_FILENO))
+                       wl->tty = STDIN_FILENO;
+               else {
+                       char path[PATH_MAX];
+
+                       snprintf(path, PATH_MAX, "/dev/tty%s", getenv("XDG_VTNR"));
+                       wl->tty = open(path, O_RDWR | O_NOCTTY);
+               }
        }
 
        if (wl->tty < 0)


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