summaryrefslogtreecommitdiffstats
path: root/usr.sbin/ppp/route.c
diff options
context:
space:
mode:
authorbrian <brian@FreeBSD.org>1997-07-28 01:02:27 +0000
committerbrian <brian@FreeBSD.org>1997-07-28 01:02:27 +0000
commit4af16ddc99f2b351a0895401a2eef3ea538a865b (patch)
tree30242310e406b57ed0cb105d6be2fdf3c3fbaca9 /usr.sbin/ppp/route.c
parent789c3c7d2933819fc67e6c20ae4cc544d5183247 (diff)
downloadFreeBSD-src-4af16ddc99f2b351a0895401a2eef3ea538a865b.zip
FreeBSD-src-4af16ddc99f2b351a0895401a2eef3ea538a865b.tar.gz
Fix file descriptor leaks.
Diffstat (limited to 'usr.sbin/ppp/route.c')
-rw-r--r--usr.sbin/ppp/route.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/usr.sbin/ppp/route.c b/usr.sbin/ppp/route.c
index 51c5ee9..cd69a4f 100644
--- a/usr.sbin/ppp/route.c
+++ b/usr.sbin/ppp/route.c
@@ -17,7 +17,7 @@
* IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
* WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
*
- * $Id: route.c,v 1.15 1997/06/13 03:59:36 brian Exp $
+ * $Id: route.c,v 1.16 1997/06/20 23:43:35 brian Exp $
*
*/
#include <sys/types.h>
@@ -67,8 +67,10 @@ struct in_addr mask;
struct sockaddr_in rtdata;
s = socket(PF_ROUTE, SOCK_RAW, 0);
- if (s < 0)
- LogPrintf(LogERROR, "socket: %s", strerror(errno));
+ if (s < 0) {
+ LogPrintf(LogERROR, "OsSetRoute: socket: %s", strerror(errno));
+ return;
+ }
bzero(&rtmes, sizeof(rtmes));
rtmes.m_rtm.rtm_version = RTM_VERSION;
@@ -357,7 +359,7 @@ char *name;
s = socket(AF_INET, SOCK_DGRAM, 0);
if (s < 0) {
- LogPrintf(LogERROR, "socket: %s", strerror(errno));
+ LogPrintf(LogERROR, "GetIfIndex: socket: %s", strerror(errno));
return(-1);
}
@@ -376,6 +378,7 @@ char *name;
ifconfs.ifc_buf = buffer;
if (ioctl(s, SIOCGIFCONF, &ifconfs) < 0) {
LogPrintf(LogERROR, "ioctl(SIOCGIFCONF): %s", strerror(errno));
+ close(s);
free(buffer);
return(-1);
}
@@ -392,6 +395,7 @@ char *name;
ifrp->ifr_addr.sa_family, elen);
if (strcmp(ifrp->ifr_name, name) == 0) {
IfIndex = index;
+ close(s);
free(buffer);
return(index);
}
OpenPOWER on IntegriCloud