diff options
author | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-05-10 18:46:33 +1000 |
---|---|---|
committer | Nguyễn Thái Ngọc Duy <pclouds@gmail.com> | 2009-05-10 18:46:33 +1000 |
commit | 1fa419fb3c7ef91e878398bb0388854d27d7bd8f (patch) | |
tree | 8ac0a1e2872d2e470c98493df2561bfbf0a21e31 | |
parent | 4e979dee506fdcf43684b55ecc52b9a2fd1dd2c1 (diff) | |
download | busybox-w32-1fa419fb3c7ef91e878398bb0388854d27d7bd8f.tar.gz busybox-w32-1fa419fb3c7ef91e878398bb0388854d27d7bd8f.tar.bz2 busybox-w32-1fa419fb3c7ef91e878398bb0388854d27d7bd8f.zip |
cygwin_tc?etattr(): dont do anything if failed to detect Cygwin tty
-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 | } |