From ce58910ee630d9485cbf712b4e14d4f4c2d4fa2a Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Mon, 13 Mar 2000 23:40:28 +0000 Subject: [PATCH] fix demand-dialling bug with new driver --- pppd/sys-linux.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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; } -- 2.39.2