Repository : ssh://git@open-mesh.org/batctl
On branches: maint,next
commit e397137aa9f4417ec21b4ba3db59b4f4e55b72fd Author: Andreas Pape APape@phoenixcontact.com Date: Thu Sep 15 10:41:00 2016 +0200
batctl: optchar variable uses wrong type
The variable "optchar" used char instead of int leading to a non working batctl tp command on some platforms. These platforms are using ABIs with unsigned as default char type.
getopt will return a negative value whenever it is finished parsing. But these platforms will then store it in an unsigned char and thus are not able to interpret later as end of the parsing loop (-1). The tpmeter code will therefore always print the usage information and terminate batctl with an error code.
Signed-off-by: Andreas Pape apape@phoenixcontact.com [sven@narfation.org: Replaced commit message] Signed-off-by: Sven Eckelmann sven@narfation.org
e397137aa9f4417ec21b4ba3db59b4f4e55b72fd tp_meter.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/tp_meter.c b/tp_meter.c index a402e45..f95b839 100644 --- a/tp_meter.c +++ b/tp_meter.c @@ -396,7 +396,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,