about summary refs log tree commit diff
path: root/inet
diff options
context:
space:
mode:
Diffstat (limited to 'inet')
-rw-r--r--inet/inet_mkadr.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/inet/inet_mkadr.c b/inet/inet_mkadr.c
index 12c9590fb1..d8d92da768 100644
--- a/inet/inet_mkadr.c
+++ b/inet/inet_mkadr.c
@@ -43,17 +43,17 @@ struct in_addr
 inet_makeaddr(net, host)
 	in_addr_t net, host;
 {
-	u_int32_t addr;
+	struct in_addr in;
 
 	if (net < 128)
-		addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
+		in.s_addr = (net << IN_CLASSA_NSHIFT) | (host & IN_CLASSA_HOST);
 	else if (net < 65536)
-		addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
+		in.s_addr = (net << IN_CLASSB_NSHIFT) | (host & IN_CLASSB_HOST);
 	else if (net < 16777216L)
-		addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
+		in.s_addr = (net << IN_CLASSC_NSHIFT) | (host & IN_CLASSC_HOST);
 	else
-		addr = net | host;
-	addr = htonl(addr);
-	return (*(struct in_addr *)&addr);
+		in.s_addr = net | host;
+	in.s_addr = htonl(in.s_addr);
+	return in;
 }
 libc_hidden_def (inet_makeaddr)