public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
From: Marek Lindner <lindner_marek@yahoo.de>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.org>
Subject: Re: [B.A.T.M.A.N.] [PATCH] batctl: exit on parse error in batctl ll
Date: Sun, 22 Jan 2012 21:46:50 +0800	[thread overview]
Message-ID: <201201222146.51275.lindner_marek@yahoo.de> (raw)
In-Reply-To: <1327238532-8433-1-git-send-email-siwu@hrz.tu-chemnitz.de>

On Sunday, January 22, 2012 21:22:12 Simon Wunderlich wrote:
> If the argument could not be understood, we should not try to
> apply something, but return from the function.
> 
> Signed-off-by: Simon Wunderlich <siwu@hrz.tu-chemnitz.de>
> ---
>  sys.c |    5 ++++-
>  1 files changed, 4 insertions(+), 1 deletions(-)
> 
> diff --git a/sys.c b/sys.c
> index 9cdccba..ab7d75f 100644
> --- a/sys.c
> +++ b/sys.c
> @@ -221,8 +221,11 @@ int handle_loglevel(char *mesh_iface, int argc, char
> **argv) log_level |= (1 << 1);
>  			else if (strcmp(argv[i], "tt") == 0)
>  				log_level |= (1 << 2);
> -			else
> +			else {
>  				log_level_usage();
> +				free(path_buff);
> +				return EXIT_FAILURE;
> +			}
>  		}
> 
>  		snprintf(str, sizeof(str), "%i", log_level);


Can't we do "goto out" instead of duplicating the free/return. If we do so, 
res should be initialized with EXIT_FAILURE.

Regards,
Marek

  reply	other threads:[~2012-01-22 13:46 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-22 13:22 [B.A.T.M.A.N.] [PATCH] batctl: exit on parse error in batctl ll Simon Wunderlich
2012-01-22 13:46 ` Marek Lindner [this message]
2012-01-22 18:31   ` [B.A.T.M.A.N.] [PATCHv2] " Simon Wunderlich
2012-01-26 19:47     ` Marek Lindner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201201222146.51275.lindner_marek@yahoo.de \
    --to=lindner_marek@yahoo.de \
    --cc=b.a.t.m.a.n@lists.open-mesh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox