From: Simon Marchi Date: Wed, 25 Mar 2020 22:39:48 +0000 (-0400) Subject: Fix: relayd: cast idigit argument to unsigned char X-Git-Tag: v2.12.0-rc2~7 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=4385b61cf515beab90337bb228e61b8c8843a9ce;p=lttng-tools.git Fix: relayd: cast idigit argument to unsigned char This diagnostic is emitted when building on cygwin: main.c:233:34: warning: array subscript has type ‘char’ [-Wchar-subscripts] 233 | if (errno != 0 || !isdigit(arg[0])) { | ~~~^~~ This is due to passing a `char` argument to isdigit. According to the man page of isdigit, the arguments of type `char` must be cast to `unsigned char`, so they are able to represent the EOF value. This patch does that, and should get rid of the warning. Change-Id: Iaed4c0b494a79b917761e65f18388f43478b97e1 Signed-off-by: Simon Marchi Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-relayd/main.c b/src/bin/lttng-relayd/main.c index 7f7c0369a..12b7b74f6 100644 --- a/src/bin/lttng-relayd/main.c +++ b/src/bin/lttng-relayd/main.c @@ -230,7 +230,7 @@ static int set_option(int opt, const char *arg, const char *optname) errno = 0; v = strtoul(arg, NULL, 0); - if (errno != 0 || !isdigit(arg[0])) { + if (errno != 0 || !isdigit((unsigned char) arg[0])) { ERR("Wrong value in --fd-pool-size parameter: %s", arg); ret = -1; goto end;