3 --- pppd/tty.c.orig 2004-11-13 13:07:29.000000000 +0100
12 #include <sys/param.h>
13 @@ -216,8 +215,11 @@ option_t tty_options[] = {
14 "Disable hardware flow control",
15 OPT_PRIOSUB | OPT_ALIAS | OPT_NOARG | OPT_VAL(-1) },
16 { "nocdtrcts", o_int, &crtscts,
17 - "Disable hardware flow control",
18 - OPT_PRIOSUB | OPT_ALIAS | OPT_NOARG | OPT_VAL(-1) },
19 + "Disable alternate hardware (DTR/CTS) flow control",
20 + OPT_PRIOSUB | OPT_NOARG | OPT_VAL(2) },
21 + { "-cdtrcts", o_int, &crtscts,
22 + "Disable alternate hardware (DTR/CTS) flow control",
23 + OPT_PRIOSUB | OPT_ALIAS | OPT_NOARG | OPT_VAL(2) },
24 { "xonxoff", o_special_noarg, (void *)setxonxoff,
25 "Set software (XON/XOFF) flow control", OPT_PRIOSUB },
27 @@ -840,7 +842,7 @@ finish_tty()
29 if (tty_mode != (mode_t) -1) {
30 if (fchmod(real_ttyfd, tty_mode) != 0)
31 - error("Couldn't restore tty permissions");
32 + warn("Couldn't restore tty permissions: %m");
34 #endif /* __linux__ */
36 @@ -1097,17 +1099,29 @@ charshunt(ifd, ofd, record_file)
38 if (ilevel >= max_level)
42 + if (pty_master >= FD_SETSIZE)
43 + fatal("descriptor too big");
44 FD_SET(pty_master, &writey);
45 - } else if (stdin_readable)
47 + } else if (stdin_readable) {
48 + if (ifd >= FD_SETSIZE)
49 + fatal("descriptor too big");
53 if (olevel >= max_level)
57 + if (ofd >= FD_SETSIZE)
58 + fatal("descriptor too big");
60 - } else if (pty_readable)
62 + } else if (pty_readable) {
63 + if (pty_master >= FD_SETSIZE)
64 + fatal("descriptor too big");
65 FD_SET(pty_master, &ready);
67 if (select(nfds, &ready, &writey, NULL, top) < 0) {
70 @@ -1145,6 +1159,8 @@ charshunt(ifd, ofd, record_file)
71 if (!record_write(recordf, 4, NULL, 0, &lasttime))
74 + if (pty_master >= FD_SETSIZE)
75 + fatal("descriptor too big");
76 FD_SET(pty_master, &writey);
78 if (!record_write(recordf, 2, ibufp, nibuf, &lasttime))
79 @@ -1172,6 +1188,8 @@ charshunt(ifd, ofd, record_file)
80 if (!record_write(recordf, 3, NULL, 0, &lasttime))
83 + if (ofd >= FD_SETSIZE)
84 + fatal("descriptor too big");
87 if (!record_write(recordf, 1, obufp, nobuf, &lasttime))