[PATCH 2/3] inet_common: handle FEATURE_ETC_NETWORKS as a compile-time flag

Johannes Schindelin johannes.schindelin at gmx.de
Fri Jul 14 14:11:46 UTC 2017


This flag is used in #if ... #endif guards elsewhere and there is no
good reason to pretend that it is a runtime flag in just one case.

This probably was an oversight in a61cb92f2 (make /etc/network parsing
configurable. -200 bytes when off., 2007-06-19).

Besides, it fixes a compile problem on systems where the getnetbyaddr()
function is not available and the /etc/networks feature is disabled.

Signed-off-by: Johannes Schindelin <johannes.schindelin at gmx.de>
---
 libbb/inet_common.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/libbb/inet_common.c b/libbb/inet_common.c
index 5b4a4a10b..f10ed29be 100644
--- a/libbb/inet_common.c
+++ b/libbb/inet_common.c
@@ -132,7 +132,9 @@ char* FAST_FUNC INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t ne
 		bb_error_msg("sockaddr2host_noport(%08x)", (unsigned)nip);
 #endif
 		name = xmalloc_sockaddr2host_noport((void*)s_in);
-	} else if (ENABLE_FEATURE_ETC_NETWORKS) {
+	}
+#if ENABLE_FEATURE_ETC_NETWORKS
+	else {
 		struct netent *np;
 #ifdef DEBUG
 		bb_error_msg("getnetbyaddr(%08x)", (unsigned)ntohl(nip));
@@ -141,6 +143,7 @@ char* FAST_FUNC INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t ne
 		if (np)
 			name = xstrdup(np->n_name);
 	}
+#endif
 	if (!name)
 		name = xmalloc_sockaddr2dotted_noport((void*)s_in);
 
-- 
2.13.3.windows.1.13.gaf0c2223da0




More information about the busybox mailing list