From: Sven Eckelmann <sven@narfation.org>
To: b.a.t.m.a.n@lists.open-mesh.org
Subject: Re: [B.A.T.M.A.N.] [PATCH] batctl: optchar variable uses wrong type
Date: Thu, 15 Sep 2016 11:25:11 +0200 [thread overview]
Message-ID: <2527721.G80JbDCa0P@bentobox> (raw)
In-Reply-To: <1473928860-30519-1-git-send-email-apape@phoenixcontact.com>
[-- Attachment #1: Type: text/plain, Size: 1255 bytes --]
On Donnerstag, 15. September 2016 10:41:00 CEST Andreas Pape wrote:
> The variable "optchar" used char instead of int leading to a non
> working batctl tp command as the while loop parsing the tp
> arguments with the getopt command is only left via the "default"
> case leaving the tp subcommand unusable. Using type char also
> lead to a compiler warning.
I find the commit message extreme confusing. It think you wanted to describe
following problem:
* some platform C ABIs define char as unsigned
* getopt can return negative values
* the loop "around" getopt waits for a negative value to stop (which never
happens with an unsigned char)
But the code change itself looks good.
Reviewed-by: Sven Eckelmann <sven@narfation.org>
Kind regards,
Sven
> ---
> tp_meter.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/tp_meter.c b/tp_meter.c
> index 7fe0d56..10dc2b9 100644
> --- a/tp_meter.c
> +++ b/tp_meter.c
> @@ -395,7 +395,7 @@ int tp_meter(char *mesh_iface, int argc, char **argv)
> int ret = EXIT_FAILURE;
> int found_args = 1, read_opt = USE_BAT_HOSTS;
> uint32_t time = 0;
> - char optchar;
> + int optchar;
> struct nl_sock *listen_sock = NULL;
> struct tp_result result = {
> .error = 0,
[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2016-09-15 9:25 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-09-15 8:41 [B.A.T.M.A.N.] [PATCH] batctl: optchar variable uses wrong type Andreas Pape
2016-09-15 9:25 ` Sven Eckelmann [this message]
2016-09-15 12:02 ` [B.A.T.M.A.N.] Donations for domain registration fees open-mesh.net/open-mesh.org elektra
2016-09-15 12:30 ` Sven Eckelmann
2016-09-15 12:59 ` Simon Wunderlich
2016-10-18 12:30 ` [B.A.T.M.A.N.] batctl: optchar variable uses wrong type Sven Eckelmann
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=2527721.G80JbDCa0P@bentobox \
--to=sven@narfation.org \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.