From 0932bf305fb761495432e2d4d5b136e6fe8ba027 Mon Sep 17 00:00:00 2001 From: "Todd C. Miller" Date: Fri, 14 Mar 2003 15:35:54 +0000 Subject: [PATCH] Move the n == 0 check for the non-getifaddrs cas --- interfaces.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/interfaces.c b/interfaces.c index 43c7bf9c5..5c338f917 100644 --- a/interfaces.c +++ b/interfaces.c @@ -218,11 +218,10 @@ load_interfaces() break; len += BUFSIZ; } - if (n == 0) - return; /* Allocate space for the maximum number of interfaces that could exist. */ - n = ifconf->ifc_len / sizeof(struct ifreq); + if ((n = ifconf->ifc_len / sizeof(struct ifreq)) == 0) + return; interfaces = (struct interface *) emalloc2(n, sizeof(struct interface)); /* For each interface, store the ip address and netmask. */ -- 2.40.0