diff options
author | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-26 15:56:51 +0100 |
---|---|---|
committer | Denys Vlasenko <vda.linux@googlemail.com> | 2011-01-26 15:56:51 +0100 |
commit | cf9d33a894230479b317ccee120342e3a32c836c (patch) | |
tree | e5bf99cd2aab7747af551b9ba7f71216ba5f5d15 | |
parent | ddd1ec1c279da19a79238ce9df820d79415fa33a (diff) | |
download | busybox-w32-cf9d33a894230479b317ccee120342e3a32c836c.tar.gz busybox-w32-cf9d33a894230479b317ccee120342e3a32c836c.tar.bz2 busybox-w32-cf9d33a894230479b317ccee120342e3a32c836c.zip |
getty: do not clear all c_cflag's (we were clearing baud bits!)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r-- | loginutils/getty.c | 40 |
1 files changed, 28 insertions, 12 deletions
diff --git a/loginutils/getty.c b/loginutils/getty.c index 035534157..3cf296ed1 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -258,13 +258,34 @@ static void termios_init(int speed) | |||
258 | if (speed != B0) | 258 | if (speed != B0) |
259 | cfsetspeed(&G.termios, speed); | 259 | cfsetspeed(&G.termios, speed); |
260 | 260 | ||
261 | /* Initial termios settings: 8-bit characters, raw-mode, blocking i/o. | 261 | /* Initial termios settings: 8-bit characters, raw mode, blocking i/o. |
262 | * Special characters are set after we have read the login name; all | 262 | * Special characters are set after we have read the login name; all |
263 | * reads will be done in raw mode anyway. Errors will be dealt with | 263 | * reads will be done in raw mode anyway. |
264 | * later on. | ||
265 | */ | 264 | */ |
266 | /* 8 bits; hang up (drop DTR) on last close; enable receive */ | 265 | /* Clear all bits except: */ |
267 | G.termios.c_cflag = CS8 | HUPCL | CREAD; | 266 | G.termios.c_cflag &= (0 |
267 | /* 2 stop bits (1 otherwise) | ||
268 | * Enable parity bit (both on input and output) | ||
269 | * Odd parity (else even) | ||
270 | */ | ||
271 | | CSTOPB | PARENB | PARODD | ||
272 | #ifdef CBAUDEX | ||
273 | | CMSPAR /* mark or space parity */ | ||
274 | #endif | ||
275 | | CBAUD /* (output) baud rate */ | ||
276 | #ifdef CBAUDEX | ||
277 | | CBAUDEX /* (output) baud rate */ | ||
278 | #endif | ||
279 | #ifdef CIBAUD | ||
280 | | CIBAUD /* input baud rate */ | ||
281 | #endif | ||
282 | #ifdef CRTSCTS | ||
283 | | CRTSCTS /* flow control using RTS/CTS pins */ | ||
284 | #endif | ||
285 | | CLOCAL | ||
286 | ); | ||
287 | /* Set: 8 bits; hang up (drop DTR) on last close; enable receive */ | ||
288 | G.termios.c_cflag |= CS8 | HUPCL | CREAD; | ||
268 | if (option_mask32 & F_LOCAL) { | 289 | if (option_mask32 & F_LOCAL) { |
269 | /* ignore Carrier Detect pin: | 290 | /* ignore Carrier Detect pin: |
270 | * opens don't block when CD is low, | 291 | * opens don't block when CD is low, |
@@ -274,13 +295,8 @@ static void termios_init(int speed) | |||
274 | } | 295 | } |
275 | #ifdef CRTSCTS | 296 | #ifdef CRTSCTS |
276 | if (option_mask32 & F_RTSCTS) | 297 | if (option_mask32 & F_RTSCTS) |
277 | G.termios.c_cflag |= CRTSCTS; /* flow control using RTS/CTS pins */ | 298 | G.termios.c_cflag |= CRTSCTS; |
278 | #endif | 299 | #endif |
279 | /* Other bits in c_cflag: | ||
280 | * CSTOPB 2 stop bits (1 otherwise) | ||
281 | * PARENB Enable parity bit (both on input and output) | ||
282 | * PARODD Odd parity (else even) | ||
283 | */ | ||
284 | G.termios.c_iflag = 0; | 300 | G.termios.c_iflag = 0; |
285 | G.termios.c_lflag = 0; | 301 | G.termios.c_lflag = 0; |
286 | /* non-raw output; add CR to each NL */ | 302 | /* non-raw output; add CR to each NL */ |
@@ -415,7 +431,7 @@ static void auto_baud(void) | |||
415 | } | 431 | } |
416 | } | 432 | } |
417 | 433 | ||
418 | /* Restore terminal settings. Errors will be dealt with later on */ | 434 | /* Restore terminal settings */ |
419 | G.termios.c_cc[VMIN] = 1; /* restore to value set by termios_init */ | 435 | G.termios.c_cc[VMIN] = 1; /* restore to value set by termios_init */ |
420 | set_termios(); | 436 | set_termios(); |
421 | } | 437 | } |