diff options
author | Clark Wang <dearvoid@gmail.com> | 2017-07-01 21:32:43 +0200 |
---|---|---|
committer | Amadeusz Sławiński <amade@asmblr.net> | 2017-07-01 21:32:43 +0200 |
commit | 0f5e9affa4c6d8cedd8b97a7f5436413ed124136 (patch) | |
tree | c01afe8eea697d7dcd6a79299770b9c8f4e9135c /src/screen.c | |
parent | f8fb068b510a6a5cf7fd374cbc91bd5635eb8f33 (diff) | |
download | screen-0f5e9affa4c6d8cedd8b97a7f5436413ed124136.tar.gz |
restore missing code which was wrongly removed
fixes regression introduced by migrating from pipe to sockets
http://lists.gnu.org/archive/html/screen-users/2017-06/msg00001.html
Diffstat (limited to 'src/screen.c')
-rw-r--r-- | src/screen.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/screen.c b/src/screen.c index 7dc6034..c3417e3 100644 --- a/src/screen.c +++ b/src/screen.c @@ -999,6 +999,7 @@ int main(int ac, char** av) attach_tty = ""; if (!detached && !lsflag && !cmdflag && !(dflag && !mflag && !rflag && !xflag) && !(sty && !SockMatch && !mflag && !rflag && !xflag)) { + int fl; /* ttyname implies isatty */ SetTtyname(true, &st); @@ -1006,6 +1007,11 @@ int main(int ac, char** av) tty_mode = (int)st.st_mode & 0777; #endif + fl = fcntl(0, F_GETFL, 0); + if (fl != -1 && (fl & (O_RDWR|O_RDONLY|O_WRONLY)) == O_RDWR) + attach_fd = 0; + + if (attach_fd == -1) { if ((n = secopen(attach_tty, O_RDWR | O_NONBLOCK, 0)) < 0) Panic(0, "Cannot open your terminal '%s' - please check.", attach_tty); |