diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-01-09 22:26:23 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-01-09 22:26:23 +1100 |
commit | 37c1b3d6fc9043123f33e64051ea56656a5e7ef4 (patch) | |
tree | 644c0ffdcb779ac87c50a223f39ded86570f48a3 /sshtty.c | |
parent | 838891fe85308399c4f350f8174013987b6a2f85 (diff) |
- djm@cvs.openbsd.org 2010/01/09 05:04:24
[mux.c sshpty.h clientloop.c sshtty.c]
quell tc[gs]etattr warnings when forcing a tty (ssh -tt), since we
usually don't actually have a tty to read/set; bz#1686 ok dtucker@
Diffstat (limited to 'sshtty.c')
-rw-r--r-- | sshtty.c | 23 |
1 files changed, 13 insertions, 10 deletions
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: sshtty.c,v 1.13 2008/05/19 15:45:07 djm Exp $ */ | 1 | /* $OpenBSD: sshtty.c,v 1.14 2010/01/09 05:04:24 djm Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -54,23 +54,25 @@ get_saved_tio(void) | |||
54 | } | 54 | } |
55 | 55 | ||
56 | void | 56 | void |
57 | leave_raw_mode(void) | 57 | leave_raw_mode(int quiet) |
58 | { | 58 | { |
59 | if (!_in_raw_mode) | 59 | if (!_in_raw_mode) |
60 | return; | 60 | return; |
61 | if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) | 61 | if (tcsetattr(fileno(stdin), TCSADRAIN, &_saved_tio) == -1) { |
62 | perror("tcsetattr"); | 62 | if (!quiet) |
63 | else | 63 | perror("tcsetattr"); |
64 | } else | ||
64 | _in_raw_mode = 0; | 65 | _in_raw_mode = 0; |
65 | } | 66 | } |
66 | 67 | ||
67 | void | 68 | void |
68 | enter_raw_mode(void) | 69 | enter_raw_mode(int quiet) |
69 | { | 70 | { |
70 | struct termios tio; | 71 | struct termios tio; |
71 | 72 | ||
72 | if (tcgetattr(fileno(stdin), &tio) == -1) { | 73 | if (tcgetattr(fileno(stdin), &tio) == -1) { |
73 | perror("tcgetattr"); | 74 | if (!quiet) |
75 | perror("tcgetattr"); | ||
74 | return; | 76 | return; |
75 | } | 77 | } |
76 | _saved_tio = tio; | 78 | _saved_tio = tio; |
@@ -86,8 +88,9 @@ enter_raw_mode(void) | |||
86 | tio.c_oflag &= ~OPOST; | 88 | tio.c_oflag &= ~OPOST; |
87 | tio.c_cc[VMIN] = 1; | 89 | tio.c_cc[VMIN] = 1; |
88 | tio.c_cc[VTIME] = 0; | 90 | tio.c_cc[VTIME] = 0; |
89 | if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) | 91 | if (tcsetattr(fileno(stdin), TCSADRAIN, &tio) == -1) { |
90 | perror("tcsetattr"); | 92 | if (!quiet) |
91 | else | 93 | perror("tcsetattr"); |
94 | } else | ||
92 | _in_raw_mode = 1; | 95 | _in_raw_mode = 1; |
93 | } | 96 | } |