Bug#762358: our netstat -s always returns 1, wrongly

Josip Rodin joy at debbugs.entuzijast.net
Sun Sep 21 14:09:28 UTC 2014

Package: net-tools
Version: 1.60-24.2


netstat -s returns 1 on all my squeeze and wheezy systems where I've tested
that (causing the Munin netstat plugin to fail, but that's another matter).

I had a look at the source and this seems to be a deviation from netstat
upstream - netstat.c-assorted_changes.patch introduces non-zero exit
statuses, but messes up in two different ways.

In squeeze, the patch says:

+                 printf("Address type not supported for stats\n");
+                 exit(1);

First of all, it's supposed to print an error on stderr, not stdout.
Disregarding that detail for a moment, it's still somehow broken:

% netstat -s | grep Address
% echo $?

In wheezy, the patch says:

+        if (!afname[0]) {
+            [... no exit ...]
+        } else {
+            [... no exit ...]
+        }
+        exit(1);

That's wrong because both cases became unconditionally treated as failures,
which they aren't.

Please fix this. TIA.

     2. That which causes joy or happiness.

More information about the Pkg-net-tools-maintainers mailing list