- len = read(ppp_dev_fd, buf, len);
- if (len < 0) {
- if (errno == EWOULDBLOCK || errno == EIO)
- return -1;
- fatal("read: %m(%d)", errno);
+ nr = -1;
+ if (new_style_driver) {
+ nr = read(ppp_dev_fd, buf, len);
+ 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");