aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPhil Blundell <philb@gnu.org>2000-02-20 17:50:01 +0000
committerPhil Blundell <philb@gnu.org>2000-02-20 17:50:01 +0000
commit6498edeb789ed250a20613926437463e7338f892 (patch)
tree3acc6532803206cc8b0d60215644e06d33f8376a
parentFrom Arnaldo Carvalho de Melo (acme@conectiva.com.br): (diff)
downloadnet-tools-6498edeb789ed250a20613926437463e7338f892.tar.gz
net-tools-6498edeb789ed250a20613926437463e7338f892.tar.bz2
net-tools-6498edeb789ed250a20613926437463e7338f892.zip
Fix netstat -ci (#6904 in RedHat bugzilla)
Patch from Jeff Johnson
-rw-r--r--lib/interface.c3
-rw-r--r--netstat.c18
2 files changed, 13 insertions, 8 deletions
diff --git a/lib/interface.c b/lib/interface.c
index 4c97818..28efbd3 100644
--- a/lib/interface.c
+++ b/lib/interface.c
@@ -4,7 +4,7 @@
10/1998 partly rewriten by Andi Kleen to support an interface list.
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"
@@ -322,6 +322,7 @@ int if_readlist(void)
#if 0
free(fmt);
#endif
+ fclose(fh);
return err;
}
diff --git a/netstat.c b/netstat.c
index 74f78e7..e14da30 100644
--- a/netstat.c
+++ b/netstat.c
@@ -6,7 +6,7 @@
* NET-3 Networking Distribution for the LINUX operating
* 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>
* Fred N. van Kempen, <waltje@uwalt.nl.mugnet.org>
@@ -1393,11 +1393,13 @@ void ife_print(struct interface *ptr)
static int iface_info(void)
{
- if ((skfd = sockets_open(0)) < 0) {
- perror("socket");
- exit(1);
+ if (skfd < 0) {
+ if ((skfd = sockets_open(0)) < 0) {
+ 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"));
if (for_all_interfaces(do_if_print, &flag_all) < 0) {
@@ -1406,8 +1408,10 @@ static int iface_info(void)
}
if (flag_cnt)
free_interface_list();
- close(skfd);
- skfd = -1;
+ else {
+ close(skfd);
+ skfd = -1;
+ }
return 0;
}