[vte] pty: Fix opening a PTY on non-linux



commit b975ca703559e9ccfad81331bca4534af6d44598
Author: Ting-Wei Lan <lantw src gnome org>
Date:   Sun May 10 21:57:01 2020 +0200

    pty: Fix opening a PTY on non-linux
    
    Commit 387b0a4924c895d14c5776093274fecd13c23138 changed the code
    from using int to store a file descriptor to using the vte::libc::FD
    class, but omitted to change some calls in the non-linux code path
    to use .get() when passing the file descriptor to a libc function.
    
    Fixes: https://gitlab.gnome.org/GNOME/vte/-/issues/245

 src/pty.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
---
diff --git a/src/pty.cc b/src/pty.cc
index 83b1c74b..e9a93eb5 100644
--- a/src/pty.cc
+++ b/src/pty.cc
@@ -417,14 +417,14 @@ _vte_pty_open_posix(void)
         }
 
 #ifndef __linux__
-        if (need_cloexec && vte::libc::fd_set_cloexec(fd) < 0) {
+        if (need_cloexec && vte::libc::fd_set_cloexec(fd.get()) < 0) {
                 auto errsv = vte::libc::ErrnoSaver{};
                 _vte_debug_print(VTE_DEBUG_PTY,
                                  "%s failed: %s", "Setting CLOEXEC flag", g_strerror(errsv));
                 return {};
         }
 
-        if (need_nonblocking && vte::libc::fd_set_nonblock(fd) < 0) {
+        if (need_nonblocking && vte::libc::fd_set_nonblock(fd.get()) < 0) {
                 auto errsv = vte::libc::ErrnoSaver{};
                 _vte_debug_print(VTE_DEBUG_PTY,
                                  "%s failed: %s", "Setting NONBLOCK flag", g_strerror(errsv));


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