diff options
| author | David Dorfman <d3dave@users.noreply.github.com> | 2019-12-28 20:22:09 +0100 |
|---|---|---|
| committer | Alexander Naumov <alexander_naumov@opensuse.org> | 2019-12-28 20:24:59 +0100 |
| commit | 4dd664149c166409b4bd20ada3144a1968f6f355 (patch) | |
| tree | 85c0773acd89c6cfd4fc914aae98f41cb1949592 /src/window.c | |
| parent | 11a1fc82fb34e18832938d63c3a4471908dae017 (diff) | |
| download | screen-4dd664149c166409b4bd20ada3144a1968f6f355.tar.gz | |
Disable exclusive mode on TTY device when closing
When opening a TTY we enable exclusive mode to prevent other tools
messing with our connection. When we are done using the TTY the
exclusive mode must be disabled so the TTY can be reconnected to
later. We remember to do this when a break is sent to the device,
but not on window close.
This change ensures we disable exclusive mode on the TTY device
whenever the window is closed.
bug #52248
Diffstat (limited to 'src/window.c')
| -rw-r--r-- | src/window.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/window.c b/src/window.c index 213e090..6499595 100644 --- a/src/window.c +++ b/src/window.c @@ -798,15 +798,23 @@ int RemakeWindow(Window *window) void CloseDevice(Window *window) { - if (window->w_ptyfd < 0) + if (window->w_ptyfd < 0) { return; - if (window->w_type == W_TYPE_PTY) { + } + switch (window->w_type) { + case W_TYPE_PTY: /* pty 4 SALE */ (void)chmod(window->w_tty, 0666); (void)chown(window->w_tty, 0, 0); ClosePTY(window->w_ptyfd); - } else + break; + case W_TYPE_PLAIN: + CloseTTY(window->w_ptyfd); + break; + default: close(window->w_ptyfd); + break; + } window->w_ptyfd = -1; window->w_tty[0] = 0; evdeq(&window->w_readev); |
