X-Git-Url: http://git.ozlabs.org/?p=ppp.git;a=blobdiff_plain;f=pppd%2Fsys-linux.c;h=928a7207f806af13225107064536e87e549a1e17;hp=7c7844d7238e647de9546d83aa15ad8a4d257579;hb=ce58910ee630d9485cbf712b4e14d4f4c2d4fa2a;hpb=5a6692da546f8a60b21a49ccfb1298812edc761d diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 7c7844d..928a720 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -851,13 +851,16 @@ int read_packet (unsigned char *buf) *buf++ = PPP_UI; len -= 2; } - nr = read(ppp_fd, buf, len); - if (new_style_driver && nr < 0 && (errno == EWOULDBLOCK || errno == EIO)) + nr = -1; + if (new_style_driver) { nr = read(ppp_dev_fd, buf, len); - if (nr < 0) { - if (errno == EWOULDBLOCK || errno == EIO) - return -1; - fatal("read: %m(%d)", errno); + if (nr < 0 && errno != EWOULDBLOCK && errno != EIO) + error("read /dev/ppp: %m"); + } + if (nr < 0 && ppp_fd >= 0) { + nr = read(ppp_fd, buf, len); + if (nr < 0 && errno != EWOULDBLOCK && errno != EIO) + error("read: %m"); } return (new_style_driver && nr > 0)? nr+2: nr; }