From 92e0657eed0b0777e5a7e3502b450aa42921fc8c Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Wed, 25 May 2011 05:30:38 -0500 Subject: ppp_net: Keep valgrind happy --- gatchat/ppp_net.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gatchat') diff --git a/gatchat/ppp_net.c b/gatchat/ppp_net.c index 1c81de07..6facc6d7 100644 --- a/gatchat/ppp_net.c +++ b/gatchat/ppp_net.c @@ -142,13 +142,14 @@ struct ppp_net *ppp_net_new(GAtPPP *ppp, int fd) * If the fd value is still the default one, * open the tun interface and configure it. */ + memset(&ifr, 0, sizeof(ifr)); + if (fd < 0) { /* open a tun interface */ fd = open("/dev/net/tun", O_RDWR); if (fd < 0) goto error; - memset(&ifr, 0, sizeof(ifr)); ifr.ifr_flags = IFF_TUN | IFF_NO_PI; strcpy(ifr.ifr_name, "ppp%d"); -- cgit v1.2.3