Fixup fromcvs/togit conversion
[minix-pkgsrc.git] / net / pppd / patches / patch-bb
blob78a4ed57d42d51bbf8532266b99ed0abf907a7e3
1 $NetBSD$
3 --- pppd/tty.c.orig     2004-11-13 13:07:29.000000000 +0100
4 +++ pppd/tty.c
5 @@ -80,7 +80,6 @@
6  #include <fcntl.h>
7  #include <syslog.h>
8  #include <netdb.h>
9 -#include <utmp.h>
10  #include <pwd.h>
11  #include <setjmp.h>
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()
28  #ifndef __linux__
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");
33         }
34  #endif /* __linux__ */
36 @@ -1097,17 +1099,29 @@ charshunt(ifd, ofd, record_file)
37         if (nibuf != 0) {
38             if (ilevel >= max_level)
39                 top = &tout;
40 -           else
41 +           else {
42 +               if (pty_master >= FD_SETSIZE)
43 +                   fatal("descriptor too big");
44                 FD_SET(pty_master, &writey);
45 -       } else if (stdin_readable)
46 +           }
47 +       } else if (stdin_readable) {
48 +           if (ifd >= FD_SETSIZE)
49 +               fatal("descriptor too big");
50             FD_SET(ifd, &ready);
51 +       }
52         if (nobuf != 0) {
53             if (olevel >= max_level)
54                 top = &tout;
55 -           else
56 +           else {
57 +               if (ofd >= FD_SETSIZE)
58 +                   fatal("descriptor too big");
59                 FD_SET(ofd, &writey);
60 -       } else if (pty_readable)
61 +           }
62 +       } else if (pty_readable) {
63 +           if (pty_master >= FD_SETSIZE)
64 +               fatal("descriptor too big");
65             FD_SET(pty_master, &ready);
66 +       }
67         if (select(nfds, &ready, &writey, NULL, top) < 0) {
68             if (errno != EINTR)
69                 fatal("select");
70 @@ -1145,6 +1159,8 @@ charshunt(ifd, ofd, record_file)
71                     if (!record_write(recordf, 4, NULL, 0, &lasttime))
72                         recordf = NULL;
73             } else {
74 +               if (pty_master >= FD_SETSIZE)
75 +                   fatal("descriptor too big");
76                 FD_SET(pty_master, &writey);
77                 if (recordf)
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))
81                         recordf = NULL;
82             } else {
83 +               if (ofd >= FD_SETSIZE)
84 +                   fatal("descriptor too big");
85                 FD_SET(ofd, &writey);
86                 if (recordf)
87                     if (!record_write(recordf, 1, obufp, nobuf, &lasttime))