From 60b7e1f88a2b7a79c793684ff4cbcd6f38ca406f Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 25 Mar 2020 18:39:48 -0400 Subject: [PATCH] Fix: relayd: cast idigit argument to unsigned char MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/bin/lttng-relayd/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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; -- 2.34.1