diff options
-rw-r--r-- | libbb/termios.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/libbb/termios.c b/libbb/termios.c index c05bb6dbb..1291bf785 100644 --- a/libbb/termios.c +++ b/libbb/termios.c | |||
@@ -169,6 +169,8 @@ static int cygwin_tcgetattr(int fd, struct termios *t) | |||
169 | { | 169 | { |
170 | int tty = fd_to_tty(fd); | 170 | int tty = fd_to_tty(fd); |
171 | struct shared_info *si = get_shared_info(); | 171 | struct shared_info *si = get_shared_info(); |
172 | if (tty < 0 || !si) | ||
173 | return -1; | ||
172 | *t = si->tty.ttys[tty].tty_min.ti; | 174 | *t = si->tty.ttys[tty].tty_min.ti; |
173 | return 0; | 175 | return 0; |
174 | } | 176 | } |
@@ -177,11 +179,9 @@ static int cygwin_tcgetattr(int fd, struct termios *t) | |||
177 | static int cygwin_tcsetattr(int fd, int mode, const struct termios *t) | 179 | static int cygwin_tcsetattr(int fd, int mode, const struct termios *t) |
178 | { | 180 | { |
179 | int tty = fd_to_tty(fd); | 181 | int tty = fd_to_tty(fd); |
180 | struct shared_info *si; | 182 | struct shared_info *si = get_shared_info(); |
181 | 183 | if (tty < 0 || !si) | |
182 | if (tty < 0) | ||
183 | return -1; | 184 | return -1; |
184 | si = get_shared_info(); | ||
185 | si->tty.ttys[tty].tty_min.ti = *t; | 185 | si->tty.ttys[tty].tty_min.ti = *t; |
186 | return 0; | 186 | return 0; |
187 | } | 187 | } |