diff options
author | brian <brian@FreeBSD.org> | 1997-10-04 00:14:39 +0000 |
---|---|---|
committer | brian <brian@FreeBSD.org> | 1997-10-04 00:14:39 +0000 |
commit | 56229906e0a3ec61fa498490cba25cfd16578bbc (patch) | |
tree | bd3abdd58c302ca8be222b1bd021fe838869838b /usr.sbin | |
parent | 0ee66dd554c39be52e4540459712024638631056 (diff) | |
download | FreeBSD-src-56229906e0a3ec61fa498490cba25cfd16578bbc.zip FreeBSD-src-56229906e0a3ec61fa498490cba25cfd16578bbc.tar.gz |
Cosmetic: Log a strerror(errno) when failing to write to
the tun device.
Diffstat (limited to 'usr.sbin')
-rw-r--r-- | usr.sbin/ppp/ip.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/usr.sbin/ppp/ip.c b/usr.sbin/ppp/ip.c index 394841e..84cb47a 100644 --- a/usr.sbin/ppp/ip.c +++ b/usr.sbin/ppp/ip.c @@ -17,7 +17,7 @@ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. * - * $Id: ip.c,v 1.23 1997/08/25 00:29:13 brian Exp $ + * $Id: ip.c,v 1.24 1997/09/03 00:40:49 brian Exp $ * * TODO: * o Return ICMP message for filterd packet @@ -33,6 +33,7 @@ #include <netinet/tcp.h> #include <arpa/inet.h> #include <alias.h> +#include <errno.h> #include "loadalias.h" #include "vars.h" #include "filter.h" @@ -382,7 +383,11 @@ IpInput(struct mbuf * bp) nb = ntohs(((struct ip *) tunbuff)->ip_len); nw = write(tun_out, tunbuff, nb); if (nw != nb) - LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); + if (nw == -1) + LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb, + strerror(errno)); + else + LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); if (iresult == PKT_ALIAS_FOUND_HEADER_FRAGMENT) { while ((fptr = VarPacketAliasGetFragment(tunbuff)) != NULL) { @@ -390,7 +395,11 @@ IpInput(struct mbuf * bp) nb = ntohs(((struct ip *) fptr)->ip_len); nw = write(tun_out, fptr, nb); if (nw != nb) - LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); + if (nw == -1) + LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb, + strerror(errno)); + else + LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); free(fptr); } } @@ -412,7 +421,10 @@ IpInput(struct mbuf * bp) ipInOctets += nb; nw = write(tun_out, tunbuff, nb); if (nw != nb) - LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); + if (nw == -1) + LogPrintf(LogERROR, "IpInput: wrote %d, got %s\n", nb, strerror(errno)); + else + LogPrintf(LogERROR, "IpInput: wrote %d, got %d\n", nb, nw); } pfree(bp); |