X-Git-Url: http://git.ozlabs.org/?a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=5a5268b7d9162fa239fe10d4a7102fc5ce78ed5b;hb=03a755882397bda31e3e44d3aa51034338ea3ce6;hp=8ec9ba70e7051e50957709ebf98e8a698140ab15;hpb=e5b7cafa28aeba66499fa26b286192529e5fde15;p=ppp.git diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 8ec9ba7..5a5268b 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -141,7 +141,7 @@ #endif /* IPX_CHANGE */ #ifdef PPP_FILTER -#include +#include #include #endif /* PPP_FILTER */ @@ -956,8 +956,8 @@ void set_up_tty(int tty_fd, int local) fatal("Baud rate for %s is 0; need explicit baud rate", devnam); } - if (tcsetattr(tty_fd, TCSAFLUSH, &tios) < 0) - if (!ok_error(errno)) + while (tcsetattr(tty_fd, TCSAFLUSH, &tios) < 0 && !ok_error(errno)) + if (errno != EINTR) fatal("tcsetattr: %m (line %d)", __LINE__); baud_rate = baud_rate_of(speed); @@ -1025,7 +1025,7 @@ void output (int unit, unsigned char *p, int len) fd = ppp_dev_fd; } if (write(fd, p, len) < 0) { - if (errno == EWOULDBLOCK || errno == ENOBUFS + if (errno == EWOULDBLOCK || errno == EAGAIN || errno == ENOBUFS || errno == ENXIO || errno == EIO || errno == EINTR) warn("write: warning: %m (%d)", errno); else @@ -1091,7 +1091,8 @@ int read_packet (unsigned char *buf) nr = -1; if (ppp_fd >= 0) { nr = read(ppp_fd, buf, len); - if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR) + if (nr < 0 && errno != EWOULDBLOCK && errno != EAGAIN + && errno != EIO && errno != EINTR) error("read: %m"); if (nr < 0 && errno == ENXIO) return 0; @@ -1099,7 +1100,8 @@ int read_packet (unsigned char *buf) if (nr < 0 && new_style_driver && ppp_dev_fd >= 0) { /* N.B. we read ppp_fd first since LCP packets come in there. */ nr = read(ppp_dev_fd, buf, len); - if (nr < 0 && errno != EWOULDBLOCK && errno != EIO && errno != EINTR) + if (nr < 0 && errno != EWOULDBLOCK && errno != EAGAIN + && errno != EIO && errno != EINTR) error("read /dev/ppp: %m"); if (nr < 0 && errno == ENXIO) return 0; @@ -1133,7 +1135,7 @@ get_loop_output(void) if (n == 0) fatal("eof on loopback"); - if (errno != EWOULDBLOCK) + if (errno != EWOULDBLOCK && errno != EAGAIN) fatal("read from loopback: %m(%d)", errno); return rv; @@ -1231,7 +1233,7 @@ void tty_recv_config(int mru, u_int32_t asyncmap, int pcomp, int accomp) * which may be done. Just return without incident. */ if (!still_ppp()) - return 0; + return; /* * Set the receiver parameters */