[rtems-libbsd commit] netstat: Initialize more global variables

Sebastian Huber sebh at rtems.org
Thu Sep 18 10:55:11 UTC 2014


Module:    rtems-libbsd
Branch:    master
Commit:    a29a71b7caa57e00cd8a86f5a36b06213e977e48
Changeset: http://git.rtems.org/rtems-libbsd/commit/?id=a29a71b7caa57e00cd8a86f5a36b06213e977e48

Author:    Sebastian Huber <sebastian.huber at embedded-brains.de>
Date:      Thu Sep 18 13:01:54 2014 +0200

netstat: Initialize more global variables

---

 freebsd/usr.bin/netstat/inet.c    |    9 +++++++++
 freebsd/usr.bin/netstat/main.c    |    3 +++
 freebsd/usr.bin/netstat/netstat.h |    3 +++
 3 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/freebsd/usr.bin/netstat/inet.c b/freebsd/usr.bin/netstat/inet.c
index 3dc57b0..cbd0932 100644
--- a/freebsd/usr.bin/netstat/inet.c
+++ b/freebsd/usr.bin/netstat/inet.c
@@ -89,6 +89,15 @@ void	inetprint(struct in_addr *, int, const char *, int);
 #ifdef INET6
 static int udp_done, tcp_done, sdp_done;
 #endif /* INET6 */
+#ifdef __rtems__
+void
+rtems_bsd_netstat_inet_init(void)
+{
+	udp_done = 0;
+	tcp_done = 0;
+	sdp_done = 0;
+}
+#endif /* __rtems__ */
 
 static int
 pcblist_sysctl(int proto, const char *name, char **bufp, int istcp)
diff --git a/freebsd/usr.bin/netstat/main.c b/freebsd/usr.bin/netstat/main.c
index 0034eb9..f3d1003 100644
--- a/freebsd/usr.bin/netstat/main.c
+++ b/freebsd/usr.bin/netstat/main.c
@@ -389,6 +389,7 @@ int rtems_bsd_command_netstat(int argc, char *argv[])
 
 	Aflag = 0;
 	aflag = 0;
+	Bflag = 0;
 	bflag = 0;
 	dflag = 0;
 	gflag = 0;
@@ -414,6 +415,8 @@ int rtems_bsd_command_netstat(int argc, char *argv[])
 	protopr_initialized = 0;
 	do_rtent = 0;
 
+	rtems_bsd_netstat_inet_init();
+
 	exit_code = rtems_bsd_program_call_main("netstat", main, argc, argv);
 
 	free(rt_tables);
diff --git a/freebsd/usr.bin/netstat/netstat.h b/freebsd/usr.bin/netstat/netstat.h
index 0b2f42e..b25b40c 100644
--- a/freebsd/usr.bin/netstat/netstat.h
+++ b/freebsd/usr.bin/netstat/netstat.h
@@ -178,3 +178,6 @@ void	tp_stats(caddr_t, caddr_t);
 void	mroutepr(u_long, u_long, u_long);
 void	mrt_stats(u_long);
 void	bpf_stats(char *);
+#ifdef __rtems__
+void	rtems_bsd_netstat_inet_init(void);
+#endif /* __rtems__ */



More information about the vc mailing list