netfilter-devel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] conntrack: do not print garbage after the usage message
@ 2009-09-30 13:02 Hannes Eder
  2009-09-30 13:27 ` Hannes Eder
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Eder @ 2009-09-30 13:02 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netdev, netfilter-devel

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

Signed-off-by: Hannes Eder <heder@google.com>

 src/conntrack.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/conntrack.c b/src/conntrack.c
index 42b5133..5ca68d1 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -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)))


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] conntrack: do not print garbage after the usage message
  2009-09-30 13:02 [PATCH] conntrack: do not print garbage after the usage message Hannes Eder
@ 2009-09-30 13:27 ` Hannes Eder
  2009-09-30 14:00   ` Hannes Eder
  0 siblings, 1 reply; 3+ messages in thread
From: Hannes Eder @ 2009-09-30 13:27 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter, netfilter-devel

[cc: -netdev, +netfilter]

Hannes Eder wrote:
> When 'conntrack' is called with no arguments then garbage is printed
> after the usage message.  This patch fixes this.
> 
> Signed-off-by: Hannes Eder <heder@google.com>
> 
>  src/conntrack.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/src/conntrack.c b/src/conntrack.c
> index 42b5133..5ca68d1 100644
> --- a/src/conntrack.c
> +++ b/src/conntrack.c
> @@ -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)))
> 


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] conntrack: do not print garbage after the usage message
  2009-09-30 13:27 ` Hannes Eder
@ 2009-09-30 14:00   ` Hannes Eder
  0 siblings, 0 replies; 3+ messages in thread
From: Hannes Eder @ 2009-09-30 14:00 UTC (permalink / raw)
  To: Pablo Neira Ayuso; +Cc: netfilter, netfilter-devel

Hannes Eder wrote:
> [cc: -netdev, +netfilter]
> 
> Hannes Eder wrote:
>> diff --git a/src/conntrack.c b/src/conntrack.c
>> index 42b5133..5ca68d1 100644
>> --- a/src/conntrack.c
>> +++ b/src/conntrack.c
>> @@ -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]) {

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 <heder@google.com>

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

Signed-off-by: Hannes Eder <heder@google.com>
---

diff --git a/src/conntrack.c b/src/conntrack.c
index 5ca68d1..0053a28 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -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)))



^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-30 14:00 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-09-30 13:02 [PATCH] conntrack: do not print garbage after the usage message Hannes Eder
2009-09-30 13:27 ` Hannes Eder
2009-09-30 14:00   ` Hannes Eder

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).