7fc2226acda4a02e2f373adc955ef466f97a7e2d
[15.05/openwrt.git] / package / l2tpd / patches / 04-nonblock.patch
1 --- l2tpd-0.70-pre20031121.orig/l2tpd.c.orig    2006-04-05 13:28:36.000000000 +0100
2 +++ l2tpd-0.70-pre20031121.orig/l2tpd.c 2006-04-05 13:33:39.000000000 +0100
3 @@ -289,6 +289,8 @@
4  #endif
5      struct termios ptyconf;
6      char *str;
7 +    int flags;
8 +
9      p = opts;
10      stropt[0] = strdup (PPPD);
11      while (p)
12 @@ -347,6 +349,14 @@
13                 close(c->fd);
14                 return -EINVAL;
15             }
16 +           flags = fcntl(c->fd, F_GETFL);
17 +           if (flags < 0 || fcntl(c->fd, F_SETFL, flags | O_NONBLOCK) < 0)
18 +           {
19 +               log (LOG_WARN, "%s: unable to fcntl(O_NONBLOCK) on pty\n",
20 +                       __FUNCTION__);
21 +               close(c->fd);
22 +               return -EINVAL;
23 +           }
24             tty = ptsname(c->fd);
25             if (tty == NULL)
26             {