diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-05 13:20:58 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2008-11-05 13:20:58 +0000 |
commit | 202ac504e1addf0aa2debd53e7cd2411cc73ac8c (patch) | |
tree | 20a02054110c8b0dbec1f94252a9d2b759dac3ae | |
parent | 905ed8730f1b78461cf83e719a1e077214c2432c (diff) | |
download | busybox-w32-202ac504e1addf0aa2debd53e7cd2411cc73ac8c.tar.gz busybox-w32-202ac504e1addf0aa2debd53e7cd2411cc73ac8c.tar.bz2 busybox-w32-202ac504e1addf0aa2debd53e7cd2411cc73ac8c.zip |
*: code shrink by adding a wrapper around very common tcsetattr(0, TCSANOW, xx) op
function old new delta
tcsetattr_stdin_TCSANOW - 14 +14
set_sane_term 116 113 -3
top_main 1277 1273 -4
make_new_session 421 415 -6
rawmode 133 126 -7
reset_term 18 10 -8
die 43 35 -8
cookmode 62 54 -8
vlock_main 425 415 -10
read_line_input 3165 3155 -10
bb_askpass 357 347 -10
fsck_minix_main 3079 3065 -14
getty_main 2375 2332 -43
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/12 up/down: 14/-131) Total: -117 bytes
-rw-r--r-- | e2fsprogs/old_e2fsprogs/e2fsck.c | 6 | ||||
-rw-r--r-- | editors/vi.c | 4 | ||||
-rw-r--r-- | include/libbb.h | 2 | ||||
-rw-r--r-- | init/init.c | 2 | ||||
-rw-r--r-- | libbb/bb_askpass.c | 4 | ||||
-rw-r--r-- | libbb/get_console.c | 2 | ||||
-rw-r--r-- | libbb/lineedit.c | 4 | ||||
-rw-r--r-- | libbb/xfuncs.c | 5 | ||||
-rw-r--r-- | loginutils/getty.c | 16 | ||||
-rw-r--r-- | loginutils/vlock.c | 4 | ||||
-rw-r--r-- | networking/telnetd.c | 2 | ||||
-rw-r--r-- | procps/top.c | 4 | ||||
-rw-r--r-- | util-linux/fsck_minix.c | 6 |
13 files changed, 34 insertions, 27 deletions
diff --git a/e2fsprogs/old_e2fsprogs/e2fsck.c b/e2fsprogs/old_e2fsprogs/e2fsck.c index 61a30f487..741536c1c 100644 --- a/e2fsprogs/old_e2fsprogs/e2fsck.c +++ b/e2fsprogs/old_e2fsprogs/e2fsck.c | |||
@@ -12281,7 +12281,7 @@ static int ask_yn(const char * string, int def) | |||
12281 | tmp.c_lflag &= ~(ICANON | ECHO); | 12281 | tmp.c_lflag &= ~(ICANON | ECHO); |
12282 | tmp.c_cc[VMIN] = 1; | 12282 | tmp.c_cc[VMIN] = 1; |
12283 | tmp.c_cc[VTIME] = 0; | 12283 | tmp.c_cc[VTIME] = 0; |
12284 | tcsetattr (0, TCSANOW, &tmp); | 12284 | tcsetattr_stdin_TCSANOW(&tmp); |
12285 | #endif | 12285 | #endif |
12286 | 12286 | ||
12287 | if (def == 1) | 12287 | if (def == 1) |
@@ -12297,7 +12297,7 @@ static int ask_yn(const char * string, int def) | |||
12297 | break; | 12297 | break; |
12298 | if (c == 3) { | 12298 | if (c == 3) { |
12299 | #ifdef HAVE_TERMIOS_H | 12299 | #ifdef HAVE_TERMIOS_H |
12300 | tcsetattr (0, TCSANOW, &termios); | 12300 | tcsetattr_stdin_TCSANOW(&termios); |
12301 | #endif | 12301 | #endif |
12302 | if (e2fsck_global_ctx && | 12302 | if (e2fsck_global_ctx && |
12303 | e2fsck_global_ctx->flags & E2F_FLAG_SETJMP_OK) { | 12303 | e2fsck_global_ctx->flags & E2F_FLAG_SETJMP_OK) { |
@@ -12323,7 +12323,7 @@ static int ask_yn(const char * string, int def) | |||
12323 | else | 12323 | else |
12324 | puts ("no\n"); | 12324 | puts ("no\n"); |
12325 | #ifdef HAVE_TERMIOS_H | 12325 | #ifdef HAVE_TERMIOS_H |
12326 | tcsetattr (0, TCSANOW, &termios); | 12326 | tcsetattr_stdin_TCSANOW(&termios); |
12327 | #endif | 12327 | #endif |
12328 | return def; | 12328 | return def; |
12329 | } | 12329 | } |
diff --git a/editors/vi.c b/editors/vi.c index 93e564756..92c069de0 100644 --- a/editors/vi.c +++ b/editors/vi.c | |||
@@ -2106,13 +2106,13 @@ static void rawmode(void) | |||
2106 | term_vi.c_cc[VMIN] = 1; | 2106 | term_vi.c_cc[VMIN] = 1; |
2107 | term_vi.c_cc[VTIME] = 0; | 2107 | term_vi.c_cc[VTIME] = 0; |
2108 | erase_char = term_vi.c_cc[VERASE]; | 2108 | erase_char = term_vi.c_cc[VERASE]; |
2109 | tcsetattr(0, TCSANOW, &term_vi); | 2109 | tcsetattr_stdin_TCSANOW(&term_vi); |
2110 | } | 2110 | } |
2111 | 2111 | ||
2112 | static void cookmode(void) | 2112 | static void cookmode(void) |
2113 | { | 2113 | { |
2114 | fflush(stdout); | 2114 | fflush(stdout); |
2115 | tcsetattr(0, TCSANOW, &term_orig); | 2115 | tcsetattr_stdin_TCSANOW(&term_orig); |
2116 | } | 2116 | } |
2117 | 2117 | ||
2118 | //----- Come here when we get a window resize signal --------- | 2118 | //----- Come here when we get a window resize signal --------- |
diff --git a/include/libbb.h b/include/libbb.h index 5b6a2dae1..086a59f05 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -1142,6 +1142,8 @@ extern void print_login_prompt(void) FAST_FUNC; | |||
1142 | /* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */ | 1142 | /* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */ |
1143 | int get_terminal_width_height(int fd, unsigned *width, unsigned *height) FAST_FUNC; | 1143 | int get_terminal_width_height(int fd, unsigned *width, unsigned *height) FAST_FUNC; |
1144 | 1144 | ||
1145 | int tcsetattr_stdin_TCSANOW(const struct termios *tp) FAST_FUNC; | ||
1146 | |||
1145 | /* NB: "unsigned request" is crucial! "int request" will break some arches! */ | 1147 | /* NB: "unsigned request" is crucial! "int request" will break some arches! */ |
1146 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC; | 1148 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC; |
1147 | int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC; | 1149 | int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC; |
diff --git a/init/init.c b/init/init.c index ae2dd6a7a..3d171d71f 100644 --- a/init/init.c +++ b/init/init.c | |||
@@ -261,7 +261,7 @@ static void set_sane_term(void) | |||
261 | tty.c_lflag = | 261 | tty.c_lflag = |
262 | ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN; | 262 | ISIG | ICANON | ECHO | ECHOE | ECHOK | ECHOCTL | ECHOKE | IEXTEN; |
263 | 263 | ||
264 | tcsetattr(STDIN_FILENO, TCSANOW, &tty); | 264 | tcsetattr_stdin_TCSANOW(&tty); |
265 | } | 265 | } |
266 | 266 | ||
267 | /* Open the new terminal device. | 267 | /* Open the new terminal device. |
diff --git a/libbb/bb_askpass.c b/libbb/bb_askpass.c index fba82a07b..c60ef3708 100644 --- a/libbb/bb_askpass.c +++ b/libbb/bb_askpass.c | |||
@@ -37,7 +37,7 @@ char* FAST_FUNC bb_askpass(int timeout, const char *prompt) | |||
37 | tio = oldtio; | 37 | tio = oldtio; |
38 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); | 38 | tio.c_iflag &= ~(IUCLC|IXON|IXOFF|IXANY); |
39 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP); | 39 | tio.c_lflag &= ~(ECHO|ECHOE|ECHOK|ECHONL|TOSTOP); |
40 | tcsetattr(STDIN_FILENO, TCSANOW, &tio); | 40 | tcsetattr_stdin_TCSANOW(&tio); |
41 | 41 | ||
42 | memset(&sa, 0, sizeof(sa)); | 42 | memset(&sa, 0, sizeof(sa)); |
43 | /* sa.sa_flags = 0; - no SA_RESTART! */ | 43 | /* sa.sa_flags = 0; - no SA_RESTART! */ |
@@ -70,7 +70,7 @@ char* FAST_FUNC bb_askpass(int timeout, const char *prompt) | |||
70 | } | 70 | } |
71 | sigaction_set(SIGINT, &oldsa); | 71 | sigaction_set(SIGINT, &oldsa); |
72 | 72 | ||
73 | tcsetattr(STDIN_FILENO, TCSANOW, &oldtio); | 73 | tcsetattr_stdin_TCSANOW(&oldtio); |
74 | bb_putchar('\n'); | 74 | bb_putchar('\n'); |
75 | fflush(stdout); | 75 | fflush(stdout); |
76 | return ret; | 76 | return ret; |
diff --git a/libbb/get_console.c b/libbb/get_console.c index ad56e740f..74022b543 100644 --- a/libbb/get_console.c +++ b/libbb/get_console.c | |||
@@ -13,7 +13,6 @@ | |||
13 | /* From <linux/kd.h> */ | 13 | /* From <linux/kd.h> */ |
14 | enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */ | 14 | enum { KDGKBTYPE = 0x4B33 }; /* get keyboard type */ |
15 | 15 | ||
16 | |||
17 | static int open_a_console(const char *fnam) | 16 | static int open_a_console(const char *fnam) |
18 | { | 17 | { |
19 | int fd; | 18 | int fd; |
@@ -37,7 +36,6 @@ static int open_a_console(const char *fnam) | |||
37 | * We try several things because opening /dev/console will fail | 36 | * We try several things because opening /dev/console will fail |
38 | * if someone else used X (which does a chown on /dev/console). | 37 | * if someone else used X (which does a chown on /dev/console). |
39 | */ | 38 | */ |
40 | |||
41 | int FAST_FUNC get_console_fd_or_die(void) | 39 | int FAST_FUNC get_console_fd_or_die(void) |
42 | { | 40 | { |
43 | static const char *const console_names[] = { | 41 | static const char *const console_names[] = { |
diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 1f21866ca..3953cc904 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c | |||
@@ -1436,7 +1436,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1436 | #define _POSIX_VDISABLE '\0' | 1436 | #define _POSIX_VDISABLE '\0' |
1437 | #endif | 1437 | #endif |
1438 | new_settings.c_cc[VINTR] = _POSIX_VDISABLE; | 1438 | new_settings.c_cc[VINTR] = _POSIX_VDISABLE; |
1439 | tcsetattr(STDIN_FILENO, TCSANOW, &new_settings); | 1439 | tcsetattr_stdin_TCSANOW(&new_settings); |
1440 | 1440 | ||
1441 | /* Now initialize things */ | 1441 | /* Now initialize things */ |
1442 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); | 1442 | previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); |
@@ -1860,7 +1860,7 @@ int FAST_FUNC read_line_input(const char *prompt, char *command, int maxsize, li | |||
1860 | #endif | 1860 | #endif |
1861 | 1861 | ||
1862 | /* restore initial_settings */ | 1862 | /* restore initial_settings */ |
1863 | tcsetattr(STDIN_FILENO, TCSANOW, &initial_settings); | 1863 | tcsetattr_stdin_TCSANOW(&initial_settings); |
1864 | /* restore SIGWINCH handler */ | 1864 | /* restore SIGWINCH handler */ |
1865 | signal(SIGWINCH, previous_SIGWINCH_handler); | 1865 | signal(SIGWINCH, previous_SIGWINCH_handler); |
1866 | fflush(stdout); | 1866 | fflush(stdout); |
diff --git a/libbb/xfuncs.c b/libbb/xfuncs.c index 8ef305ba0..e2aee136c 100644 --- a/libbb/xfuncs.c +++ b/libbb/xfuncs.c | |||
@@ -289,3 +289,8 @@ int FAST_FUNC get_terminal_width_height(int fd, unsigned *width, unsigned *heigh | |||
289 | 289 | ||
290 | return ret; | 290 | return ret; |
291 | } | 291 | } |
292 | |||
293 | int FAST_FUNC tcsetattr_stdin_TCSANOW(const struct termios *tp) | ||
294 | { | ||
295 | return tcsetattr(STDIN_FILENO, TCSANOW, tp); | ||
296 | } | ||
diff --git a/loginutils/getty.c b/loginutils/getty.c index 8b0e729fb..0f536888b 100644 --- a/loginutils/getty.c +++ b/loginutils/getty.c | |||
@@ -279,7 +279,7 @@ static void termios_init(struct termios *tp, int speed, struct options *op) | |||
279 | */ | 279 | */ |
280 | #ifdef __linux__ | 280 | #ifdef __linux__ |
281 | /* flush input and output queues, important for modems! */ | 281 | /* flush input and output queues, important for modems! */ |
282 | ioctl(0, TCFLSH, TCIOFLUSH); | 282 | ioctl(0, TCFLSH, TCIOFLUSH); /* tcflush(0, TCIOFLUSH)? - same */ |
283 | #endif | 283 | #endif |
284 | 284 | ||
285 | tp->c_cflag = CS8 | HUPCL | CREAD | speed; | 285 | tp->c_cflag = CS8 | HUPCL | CREAD | speed; |
@@ -297,7 +297,7 @@ static void termios_init(struct termios *tp, int speed, struct options *op) | |||
297 | tp->c_cflag |= CRTSCTS; | 297 | tp->c_cflag |= CRTSCTS; |
298 | #endif | 298 | #endif |
299 | 299 | ||
300 | ioctl(0, TCSETS, tp); | 300 | tcsetattr_stdin_TCSANOW(tp); |
301 | 301 | ||
302 | debug("term_io 2\n"); | 302 | debug("term_io 2\n"); |
303 | } | 303 | } |
@@ -334,7 +334,7 @@ static void auto_baud(char *buf, unsigned size_buf, struct termios *tp) | |||
334 | tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */ | 334 | tp->c_iflag |= ISTRIP; /* enable 8th-bit stripping */ |
335 | vmin = tp->c_cc[VMIN]; | 335 | vmin = tp->c_cc[VMIN]; |
336 | tp->c_cc[VMIN] = 0; /* don't block if queue empty */ | 336 | tp->c_cc[VMIN] = 0; /* don't block if queue empty */ |
337 | ioctl(0, TCSETS, tp); | 337 | tcsetattr_stdin_TCSANOW(tp); |
338 | 338 | ||
339 | /* | 339 | /* |
340 | * Wait for a while, then read everything the modem has said so far and | 340 | * Wait for a while, then read everything the modem has said so far and |
@@ -359,7 +359,7 @@ static void auto_baud(char *buf, unsigned size_buf, struct termios *tp) | |||
359 | /* Restore terminal settings. Errors will be dealt with later on. */ | 359 | /* Restore terminal settings. Errors will be dealt with later on. */ |
360 | tp->c_iflag = iflag; | 360 | tp->c_iflag = iflag; |
361 | tp->c_cc[VMIN] = vmin; | 361 | tp->c_cc[VMIN] = vmin; |
362 | ioctl(0, TCSETS, tp); | 362 | tcsetattr_stdin_TCSANOW(tp); |
363 | } | 363 | } |
364 | 364 | ||
365 | /* do_prompt - show login prompt, optionally preceded by /etc/issue contents */ | 365 | /* do_prompt - show login prompt, optionally preceded by /etc/issue contents */ |
@@ -404,7 +404,7 @@ static char *get_logname(char *logname, unsigned size_logname, | |||
404 | 404 | ||
405 | /* Flush pending input (esp. after parsing or switching the baud rate). */ | 405 | /* Flush pending input (esp. after parsing or switching the baud rate). */ |
406 | sleep(1); | 406 | sleep(1); |
407 | ioctl(0, TCFLSH, TCIFLUSH); | 407 | ioctl(0, TCFLSH, TCIFLUSH); /* tcflush(0, TCIOFLUSH)? - same */ |
408 | 408 | ||
409 | /* Prompt for and read a login name. */ | 409 | /* Prompt for and read a login name. */ |
410 | logname[0] = '\0'; | 410 | logname[0] = '\0'; |
@@ -552,12 +552,13 @@ static void termios_final(struct options *op, struct termios *tp, struct chardat | |||
552 | } | 552 | } |
553 | #endif | 553 | #endif |
554 | /* Optionally enable hardware flow control */ | 554 | /* Optionally enable hardware flow control */ |
555 | #ifdef CRTSCTS | 555 | #ifdef CRTSCTS |
556 | if (op->flags & F_RTSCTS) | 556 | if (op->flags & F_RTSCTS) |
557 | tp->c_cflag |= CRTSCTS; | 557 | tp->c_cflag |= CRTSCTS; |
558 | #endif | 558 | #endif |
559 | 559 | ||
560 | /* Finally, make the new settings effective */ | 560 | /* Finally, make the new settings effective */ |
561 | /* It's tcsetattr_stdin_TCSANOW() + error check */ | ||
561 | ioctl_or_perror_and_die(0, TCSETS, tp, "%s: TCSETS", op->tty); | 562 | ioctl_or_perror_and_die(0, TCSETS, tp, "%s: TCSETS", op->tty); |
562 | } | 563 | } |
563 | 564 | ||
@@ -689,6 +690,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv) | |||
689 | * by patching the SunOS kernel variable "zsadtrlow" to a larger value; | 690 | * by patching the SunOS kernel variable "zsadtrlow" to a larger value; |
690 | * 5 seconds seems to be a good value. | 691 | * 5 seconds seems to be a good value. |
691 | */ | 692 | */ |
693 | /* tcgetattr() + error check */ | ||
692 | ioctl_or_perror_and_die(0, TCGETS, &termios, "%s: TCGETS", options.tty); | 694 | ioctl_or_perror_and_die(0, TCGETS, &termios, "%s: TCGETS", options.tty); |
693 | 695 | ||
694 | #ifdef __linux__ | 696 | #ifdef __linux__ |
@@ -753,7 +755,7 @@ int getty_main(int argc UNUSED_PARAM, char **argv) | |||
753 | baud_index = (baud_index + 1) % options.numspeed; | 755 | baud_index = (baud_index + 1) % options.numspeed; |
754 | termios.c_cflag &= ~CBAUD; | 756 | termios.c_cflag &= ~CBAUD; |
755 | termios.c_cflag |= options.speeds[baud_index]; | 757 | termios.c_cflag |= options.speeds[baud_index]; |
756 | ioctl(0, TCSETS, &termios); | 758 | tcsetattr_stdin_TCSANOW(&termios); |
757 | } | 759 | } |
758 | } | 760 | } |
759 | 761 | ||
diff --git a/loginutils/vlock.c b/loginutils/vlock.c index 42ef44732..0262da5bd 100644 --- a/loginutils/vlock.c +++ b/loginutils/vlock.c | |||
@@ -87,7 +87,7 @@ int vlock_main(int argc UNUSED_PARAM, char **argv) | |||
87 | term.c_iflag |= IGNBRK; | 87 | term.c_iflag |= IGNBRK; |
88 | term.c_lflag &= ~ISIG; | 88 | term.c_lflag &= ~ISIG; |
89 | term.c_lflag &= ~(ECHO | ECHOCTL); | 89 | term.c_lflag &= ~(ECHO | ECHOCTL); |
90 | tcsetattr(STDIN_FILENO, TCSANOW, &term); | 90 | tcsetattr_stdin_TCSANOW(&term); |
91 | 91 | ||
92 | do { | 92 | do { |
93 | printf("Virtual console%s locked by %s.\n", | 93 | printf("Virtual console%s locked by %s.\n", |
@@ -101,6 +101,6 @@ int vlock_main(int argc UNUSED_PARAM, char **argv) | |||
101 | } while (1); | 101 | } while (1); |
102 | 102 | ||
103 | ioctl(STDIN_FILENO, VT_SETMODE, &ovtm); | 103 | ioctl(STDIN_FILENO, VT_SETMODE, &ovtm); |
104 | tcsetattr(STDIN_FILENO, TCSANOW, &oterm); | 104 | tcsetattr_stdin_TCSANOW(&oterm); |
105 | fflush_stdout_and_exit(EXIT_SUCCESS); | 105 | fflush_stdout_and_exit(EXIT_SUCCESS); |
106 | } | 106 | } |
diff --git a/networking/telnetd.c b/networking/telnetd.c index 7f748641b..efc2bf607 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c | |||
@@ -243,7 +243,7 @@ make_new_session( | |||
243 | termbuf.c_iflag |= ICRNL; | 243 | termbuf.c_iflag |= ICRNL; |
244 | termbuf.c_iflag &= ~IXOFF; | 244 | termbuf.c_iflag &= ~IXOFF; |
245 | /*termbuf.c_lflag &= ~ICANON;*/ | 245 | /*termbuf.c_lflag &= ~ICANON;*/ |
246 | tcsetattr(0, TCSANOW, &termbuf); | 246 | tcsetattr_stdin_TCSANOW(&termbuf); |
247 | 247 | ||
248 | /* Uses FILE-based I/O to stdout, but does fflush(stdout), | 248 | /* Uses FILE-based I/O to stdout, but does fflush(stdout), |
249 | * so should be safe with vfork. | 249 | * so should be safe with vfork. |
diff --git a/procps/top.c b/procps/top.c index 908ae8151..1d22871f6 100644 --- a/procps/top.c +++ b/procps/top.c | |||
@@ -649,7 +649,7 @@ static void clearmems(void) | |||
649 | 649 | ||
650 | static void reset_term(void) | 650 | static void reset_term(void) |
651 | { | 651 | { |
652 | tcsetattr(0, TCSANOW, &initial_settings); | 652 | tcsetattr_stdin_TCSANOW(&initial_settings); |
653 | if (ENABLE_FEATURE_CLEAN_UP) { | 653 | if (ENABLE_FEATURE_CLEAN_UP) { |
654 | clearmems(); | 654 | clearmems(); |
655 | #if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE | 655 | #if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE |
@@ -941,7 +941,7 @@ int top_main(int argc UNUSED_PARAM, char **argv) | |||
941 | new_settings.c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL); | 941 | new_settings.c_lflag &= ~(ISIG | ICANON | ECHO | ECHONL); |
942 | 942 | ||
943 | bb_signals(BB_FATAL_SIGS, sig_catcher); | 943 | bb_signals(BB_FATAL_SIGS, sig_catcher); |
944 | tcsetattr(0, TCSANOW, (void *) &new_settings); | 944 | tcsetattr_stdin_TCSANOW(&new_settings); |
945 | #endif /* FEATURE_USE_TERMIOS */ | 945 | #endif /* FEATURE_USE_TERMIOS */ |
946 | 946 | ||
947 | #if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE | 947 | #if ENABLE_FEATURE_TOP_CPU_USAGE_PERCENTAGE |
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index 2dbd437a3..78a7c826b 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c | |||
@@ -293,7 +293,7 @@ static void die(const char *str) NORETURN; | |||
293 | static void die(const char *str) | 293 | static void die(const char *str) |
294 | { | 294 | { |
295 | if (termios_set) | 295 | if (termios_set) |
296 | tcsetattr(0, TCSANOW, &sv_termios); | 296 | tcsetattr_stdin_TCSANOW(&sv_termios); |
297 | bb_error_msg_and_die("%s", str); | 297 | bb_error_msg_and_die("%s", str); |
298 | } | 298 | } |
299 | 299 | ||
@@ -1254,7 +1254,7 @@ int fsck_minix_main(int argc UNUSED_PARAM, char **argv) | |||
1254 | tcgetattr(0, &sv_termios); | 1254 | tcgetattr(0, &sv_termios); |
1255 | tmp = sv_termios; | 1255 | tmp = sv_termios; |
1256 | tmp.c_lflag &= ~(ICANON | ECHO); | 1256 | tmp.c_lflag &= ~(ICANON | ECHO); |
1257 | tcsetattr(0, TCSANOW, &tmp); | 1257 | tcsetattr_stdin_TCSANOW(&tmp); |
1258 | termios_set = 1; | 1258 | termios_set = 1; |
1259 | } | 1259 | } |
1260 | 1260 | ||
@@ -1299,7 +1299,7 @@ int fsck_minix_main(int argc UNUSED_PARAM, char **argv) | |||
1299 | write_superblock(); | 1299 | write_superblock(); |
1300 | 1300 | ||
1301 | if (OPT_manual) | 1301 | if (OPT_manual) |
1302 | tcsetattr(0, TCSANOW, &sv_termios); | 1302 | tcsetattr_stdin_TCSANOW(&sv_termios); |
1303 | 1303 | ||
1304 | if (changed) | 1304 | if (changed) |
1305 | retcode += 3; | 1305 | retcode += 3; |