diff options
author | brian <brian@FreeBSD.org> | 2004-09-05 01:46:52 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 2004-09-05 01:46:52 +0000 |
commit | 6f864d0a973a7f3987d73132be311b7cfbd1ccfc (patch) | |
tree | fb5af1860e245ef67196527d9ba46e5c9e284bf6 /usr.sbin/ppp/bundle.c | |
parent | 2f8e87b45e5735ee9774fce8bc8ffaf1fdc72657 (diff) | |
download | FreeBSD-src-6f864d0a973a7f3987d73132be311b7cfbd1ccfc.zip FreeBSD-src-6f864d0a973a7f3987d73132be311b7cfbd1ccfc.tar.gz |
Make ppp WARNS=5 clean
Diffstat (limited to 'usr.sbin/ppp/bundle.c')
-rw-r--r-- | usr.sbin/ppp/bundle.c | 39 |
1 files changed, 21 insertions, 18 deletions
diff --git a/usr.sbin/ppp/bundle.c b/usr.sbin/ppp/bundle.c index be55a6a..fdaa830 100644 --- a/usr.sbin/ppp/bundle.c +++ b/usr.sbin/ppp/bundle.c @@ -164,7 +164,7 @@ bundle_NewPhase(struct bundle *bundle, u_int new) } static void -bundle_LayerStart(void *v, struct fsm *fp) +bundle_LayerStart(void *v __unused, struct fsm *fp __unused) { /* The given FSM is about to start up ! */ } @@ -529,7 +529,7 @@ bundle_IsSet(struct fdescriptor *d, const fd_set *fdset) } static void -bundle_DescriptorRead(struct fdescriptor *d, struct bundle *bundle, +bundle_DescriptorRead(struct fdescriptor *d __unused, struct bundle *bundle, const fd_set *fdset) { struct datalink *dl; @@ -641,7 +641,7 @@ bundle_DescriptorRead(struct fdescriptor *d, struct bundle *bundle, } static int -bundle_DescriptorWrite(struct fdescriptor *d, struct bundle *bundle, +bundle_DescriptorWrite(struct fdescriptor *d __unused, struct bundle *bundle, const fd_set *fdset) { struct datalink *dl; @@ -1092,7 +1092,7 @@ bundle_ShowStatus(struct cmdargs const *arg) else prompt_Printf(arg->prompt, "none\n"); - prompt_Printf(arg->prompt, " Choked Timer: %ds\n", + prompt_Printf(arg->prompt, " Choked Timer: %us\n", arg->bundle->cfg.choked.timeout); #ifndef NORADIUS @@ -1101,9 +1101,9 @@ bundle_ShowStatus(struct cmdargs const *arg) prompt_Printf(arg->prompt, " Idle Timer: "); if (arg->bundle->cfg.idle.timeout) { - prompt_Printf(arg->prompt, "%ds", arg->bundle->cfg.idle.timeout); + prompt_Printf(arg->prompt, "%us", arg->bundle->cfg.idle.timeout); if (arg->bundle->cfg.idle.min_timeout) - prompt_Printf(arg->prompt, ", min %ds", + prompt_Printf(arg->prompt, ", min %us", arg->bundle->cfg.idle.min_timeout); remaining = bundle_RemainingIdleTime(arg->bundle); if (remaining != -1) @@ -1173,9 +1173,10 @@ bundle_StartIdleTimer(struct bundle *bundle, unsigned secs) /* We want at least `secs' */ if (bundle->cfg.idle.min_timeout > secs && bundle->upat) { - int up = now - bundle->upat; + unsigned up = now - bundle->upat; - if ((long long)bundle->cfg.idle.min_timeout - up > (long long)secs) + if (bundle->cfg.idle.min_timeout > up && + bundle->cfg.idle.min_timeout - up > (long long)secs) /* Only increase from the current `remaining' value */ secs = bundle->cfg.idle.min_timeout - up; } @@ -1189,11 +1190,11 @@ bundle_StartIdleTimer(struct bundle *bundle, unsigned secs) } void -bundle_SetIdleTimer(struct bundle *bundle, int timeout, int min_timeout) +bundle_SetIdleTimer(struct bundle *bundle, unsigned timeout, + unsigned min_timeout) { bundle->cfg.idle.timeout = timeout; - if (min_timeout >= 0) - bundle->cfg.idle.min_timeout = min_timeout; + bundle->cfg.idle.min_timeout = min_timeout; if (ncp_LayersOpen(&bundle->ncp)) bundle_StartIdleTimer(bundle, 0); } @@ -1370,7 +1371,8 @@ void bundle_ReceiveDatalink(struct bundle *bundle, int s) { char cmsgbuf[sizeof(struct cmsghdr) + sizeof(int) * SEND_MAXFD]; - int niov, expect, f, *fd, nfd, onfd, got; + int niov, expect, f, *fd, nfd, onfd; + ssize_t got; struct iovec iov[SCATTER_SEGMENTS]; struct cmsghdr *cmsg; struct msghdr msg; @@ -1419,7 +1421,7 @@ bundle_ReceiveDatalink(struct bundle *bundle, int s) log_Printf(LogDEBUG, "Expecting %u scatter/gather bytes\n", (unsigned)iov[0].iov_len); - if ((got = recvmsg(s, &msg, MSG_WAITALL)) != iov[0].iov_len) { + if ((got = recvmsg(s, &msg, MSG_WAITALL)) != (ssize_t)iov[0].iov_len) { if (got == -1) log_Printf(LogERROR, "Failed recvmsg: %s\n", strerror(errno)); else @@ -1536,7 +1538,8 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) struct cmsghdr *cmsg; struct msghdr msg; struct iovec iov[SCATTER_SEGMENTS]; - int niov, f, expect, newsid, fd[SEND_MAXFD], nfd, reply[2], got; + int niov, f, expect, newsid, fd[SEND_MAXFD], nfd, reply[2]; + ssize_t got; pid_t newpid; log_Printf(LogPHASE, "Transmitting datalink %s\n", dl->name); @@ -1608,7 +1611,7 @@ bundle_SendDatalink(struct datalink *dl, int s, struct sockaddr_un *sun) if ((got = sendmsg(s, &msg, 0)) == -1) log_Printf(LogERROR, "Failed sendmsg: %s: %s\n", sun->sun_path, strerror(errno)); - else if (got != iov[0].iov_len) + else if (got != (ssize_t)iov[0].iov_len) log_Printf(LogERROR, "%s: Failed initial sendmsg: Only sent %d of %u\n", sun->sun_path, got, (unsigned)iov[0].iov_len); else { @@ -1819,11 +1822,11 @@ bundle_setsid(struct bundle *bundle, int holdsession) } } -int +unsigned bundle_HighestState(struct bundle *bundle) { struct datalink *dl; - int result = DATALINK_CLOSED; + unsigned result = DATALINK_CLOSED; for (dl = bundle->links; dl; dl = dl->next) if (result < dl->state) @@ -1916,7 +1919,7 @@ bundle_CalculateBandwidth(struct bundle *bundle) #endif if (maxoverhead) { - log_Printf(LogLCP, "Reducing MTU from %d to %d (CCP requirement)\n", + log_Printf(LogLCP, "Reducing MTU from %lu to %lu (CCP requirement)\n", bundle->iface->mtu, bundle->iface->mtu - maxoverhead); bundle->iface->mtu -= maxoverhead; } |