On Mon, Dec 16, 2002 at 10:05:14PM -0800, Ryan T. Sammartino wrote:
> 
> Some more info about my problems with netstat:
> 
> Program received signal SIGSEGV, Segmentation fault.
> 0x08049941 in prg_cache_get (inode=-979118814) at netstat.c:281
> 281             if (pn->inode==inode) return(pn->name);

Here is a patch that works around the problem:


--- netstat.c.orig      2002-12-16 22:15:10.000000000 -0800
+++ netstat.c   2002-12-16 22:17:09.000000000 -0800
@@ -277,6 +277,10 @@
     unsigned hi=PRG_HASHIT(inode);
     struct prg_node *pn;
 
+    /* Sanity check - if inode < 0, bad things happen. */
+    if (hi >= PRG_HASH_SIZE)
+       return("-");
+
     for (pn=prg_hash[hi];pn;pn=pn->next)
        if (pn->inode==inode) return(pn->name);
     return("-");


Here is a patch for the spec file:


--- net-tools.spec.orig 2002-12-16 22:25:26.000000000 -0800
+++ net-tools.spec      2002-12-16 22:26:16.000000000 -0800
@@ -1,5 +1,5 @@
 %define version 1.60
-%define release 5mdk
+%define release 6mdk
 %define url http://www.tazenda.demon.co.uk/phil/net-tools/
 
 Summary: The basic tools for setting up networking.
@@ -19,6 +19,7 @@
 Patch2: net-tools-1.57-bug22040.patch.bz2
 Patch3: net-tools-1.60-manydevs.patch.bz2
 Patch4: net-tools-1.60-virtualname.patch.bz2
+Patch5: net-tools-1.60-negative-inode.patch.bz2
 
 %description
 The net-tools package contains the basic tools needed for setting up
@@ -30,6 +31,7 @@
 %patch2 -p1 -b .bug22040
 %patch3 -p0 -b .manydevs
 %patch4 -p1 -b .virtualname
+%patch5 -p0 -b .negative-inode
 
 bzcat %SOURCE1 > ./config.h
 bzcat %SOURCE2 > ./config.make
@@ -69,6 +71,9 @@
 %lang(pt_BR)   %{_mandir}/pt_BR/man[158]/*
 
 %changelog
+* Mon Dec 16 2002 Ryan T. Sammartino <[EMAIL PROTECTED]> 1.60-6mdk
+- work around crash with netstat -p and negative inode numbers
+
 * Wed Aug 21 2002 Frederic Lepied <[EMAIL PROTECTED]> 1.60-5mdk
 - merged with rh
 


-- 
Ryan T. Sammartino
http://members.shaw.ca/ryants/
Life can be so tragic -- you're here today and here tomorrow.

Reply via email to