Commit 6498edeb authored by Phil Blundell's avatar Phil Blundell

Fix netstat -ci (#6904 in RedHat bugzilla)

Patch from Jeff Johnson
parent 052e8394
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
10/1998 partly rewriten by Andi Kleen to support an interface list. 10/1998 partly rewriten by Andi Kleen to support an interface list.
I don't claim that the list operations are efficient @). I don't claim that the list operations are efficient @).
$Id: interface.c,v 1.7 1999/12/11 13:35:59 freitag Exp $ $Id: interface.c,v 1.8 2000/02/20 17:50:08 philip Exp $
*/ */
#include "config.h" #include "config.h"
...@@ -322,6 +322,7 @@ int if_readlist(void) ...@@ -322,6 +322,7 @@ int if_readlist(void)
#if 0 #if 0
free(fmt); free(fmt);
#endif #endif
fclose(fh);
return err; return err;
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* NET-3 Networking Distribution for the LINUX operating * NET-3 Networking Distribution for the LINUX operating
* system. * system.
* *
* Version: $Id: netstat.c,v 1.31 1999/11/20 22:49:18 philip Exp $ * Version: $Id: netstat.c,v 1.32 2000/02/20 17:50:01 philip Exp $
* *
* Authors: Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de> * Authors: Fred Baumgarten, <dc6iq@insu1.etec.uni-karlsruhe.de>
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org> * Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
...@@ -1393,11 +1393,13 @@ void ife_print(struct interface *ptr) ...@@ -1393,11 +1393,13 @@ void ife_print(struct interface *ptr)
static int iface_info(void) static int iface_info(void)
{ {
if ((skfd = sockets_open(0)) < 0) { if (skfd < 0) {
perror("socket"); if ((skfd = sockets_open(0)) < 0) {
exit(1); perror("socket");
exit(1);
}
printf(_("Kernel Interface table\n"));
} }
printf(_("Kernel Interface table\n"));
printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n")); printf(_("Iface MTU Met RX-OK RX-ERR RX-DRP RX-OVR TX-OK TX-ERR TX-DRP TX-OVR Flg\n"));
if (for_all_interfaces(do_if_print, &flag_all) < 0) { if (for_all_interfaces(do_if_print, &flag_all) < 0) {
...@@ -1406,8 +1408,10 @@ static int iface_info(void) ...@@ -1406,8 +1408,10 @@ static int iface_info(void)
} }
if (flag_cnt) if (flag_cnt)
free_interface_list(); free_interface_list();
close(skfd); else {
skfd = -1; close(skfd);
skfd = -1;
}
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment