Skip to contentSkip to conversation

conntrack: do not print garbage after the usage message

PATCH In review Hannes Eder 1 participant 3 messages Sep 30, 2009

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 conntrack: do not print garbage after the usage message

When 'conntrack' is called with no arguments then garbage is printed after the usage message. This patch fixes this.

 src/conntrack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/conntrack.c +1 -1
index 42b5133..5ca68d1 100644
@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[])
 
 	free_options();
 
-	if (exit_msg[cmd][0]) {
+	if (cmd != CT_NONE && exit_msg[cmd][0]) {
 		fprintf(stderr, "%s v%s (conntrack-tools): ",PROGNAME,VERSION);
 		fprintf(stderr, exit_msg[cmd], counter);
 		if (counter == 0 && !(command & (CT_LIST | EXP_LIST)))
#1 lore raw

[cc: -netdev, +netfilter]

Quoted 22 lines · Hannes Eder

When 'conntrack' is called with no arguments then garbage is printed after the usage message. This patch fixes this.

 src/conntrack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
src/conntrack.c +1 -1
index 42b5133..5ca68d1 100644
@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[])
 
 	free_options();
 
-	if (exit_msg[cmd][0]) {
+	if (cmd != CT_NONE && exit_msg[cmd][0]) {
 		fprintf(stderr, "%s v%s (conntrack-tools): ",PROGNAME,VERSION);
 		fprintf(stderr, exit_msg[cmd], counter);
 		if (counter == 0 && !(command & (CT_LIST | EXP_LIST)))
#2 lore raw
Quoted 9 lines · Hannes Eder

[cc: -netdev, +netfilter]

Quoted 6 lines · Hannes Eder
src/conntrack.c +0 -0
index 42b5133..5ca68d1 100644
@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[])
 
Quoted 4 lines

src/conntrack.c int main(int argc, char *argv[]) · line 1496

Quoted 4 lines
src/conntrack.c +1 -1
     free_options();
 
-    if (exit_msg[cmd][0]) {
+    if (cmd != CT_NONE && exit_msg[cmd][0]) {

Ups, this does not work, in case of

# conntrack -L conntrack
...

the final:

conntrack v0.9.13 (conntrack-tools): XXX flow entries have been shown.

Is missing, the following should do the trick. Sorry for the noise.

From: Hannes Eder <[email protected]>

When 'conntrack' is called with no arguments then garbage is printed after the usage message. This patch fixes this.

---

src/conntrack.c +1 -1
index 5ca68d1..0053a28 100644
@@ -1493,7 +1493,7 @@ int main(int argc, char *argv[])
 
        free_options();
 
-       if (cmd != CT_NONE && exit_msg[cmd][0]) {
+       if (command && exit_msg[cmd][0]) {
                fprintf(stderr, "%s v%s (conntrack-tools): ",PROGNAME,VERSION);
                fprintf(stderr, exit_msg[cmd], counter);
                if (counter == 0 && !(command & (CT_LIST | EXP_LIST)))