From: Paul Mackerras Date: Sat, 10 Mar 2001 11:42:22 +0000 (+0000) Subject: fix a couple of bugs reported on the linux-ppp list: X-Git-Tag: ppp-2.4.7~496 X-Git-Url: https://git.ozlabs.org/?p=ppp.git;a=commitdiff_plain;h=b49b9d4f3f7c175c722aa4e42da1458d54365b20 fix a couple of bugs reported on the linux-ppp list: set debug flags in channel, parse our version string correctly --- diff --git a/pppd/sys-linux.c b/pppd/sys-linux.c index 017248b..74ee20a 100644 --- a/pppd/sys-linux.c +++ b/pppd/sys-linux.c @@ -469,8 +469,12 @@ int establish_ppp (int tty_fd) if (!looped) set_kdebugflag (kdebugflag); - set_flags(ppp_fd, get_flags(ppp_fd) & ~(SC_RCV_B7_0 | SC_RCV_B7_1 | - SC_RCV_EVNP | SC_RCV_ODDP)); +#define SC_RCVB (SC_RCV_B7_0 | SC_RCV_B7_1 | SC_RCV_EVNP | SC_RCV_ODDP) +#define SC_LOGB (SC_DEBUG | SC_LOG_INPKT | SC_LOG_OUTPKT | SC_LOG_RAWIN \ + | SC_LOG_FLUSH) + + set_flags(ppp_fd, ((get_flags(ppp_fd) & ~(SC_RCVB | SC_LOGB)) + | ((kdebugflag * SC_DEBUG) & SC_LOGB))); SYSDEBUG ((LOG_NOTICE, "Using version %d.%d.%d of PPP driver", driver_version, driver_modification, driver_patch)); @@ -1808,24 +1812,20 @@ u_int32_t GetMask (u_int32_t addr) static void decode_version (char *buf, int *version, int *modification, int *patch) { - *version = (int) strtoul (buf, &buf, 10); + char *endp; + + *version = (int) strtoul (buf, &endp, 10); *modification = 0; *patch = 0; - if (*buf == '.') { - ++buf; - *modification = (int) strtoul (buf, &buf, 10); - if (*buf == '.') { - ++buf; + if (endp != buf && *endp == '.') { + buf = endp + 1; + *modification = (int) strtoul (buf, &endp, 10); + if (endp != buf && *endp == '.') { + buf = endp + 1; *patch = (int) strtoul (buf, &buf, 10); } } - - if (*buf != '\0') { - *version = - *modification = - *patch = 0; - } } /********************************************************************