From 0f1ba99cb2fa8f0c5a89182b95a12c7c05f0c43e Mon Sep 17 00:00:00 2001 From: Anssi Hannula Date: Thu, 24 Feb 2022 15:47:42 +0200 Subject: [PATCH] imx_uart: fix option parsing on ARM and other unsigned-char systems imx_uart assigns the return value of getopt_long() to a char variable. On systems that default to unsigned char (e.g. arm, aarch64, powerpc, s390) this causes the termination return value -1 to be read as 0xff and the option parsing loop never terminates, causing the program to get immediately stuck. Fix that by using an int which is the actual return type of getopt_long(). imx_usb already correctly uses int. Fixes #116. Signed-off-by: Anssi Hannula --- imx_uart.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/imx_uart.c b/imx_uart.c index 4d54513..7bc2e54 100644 --- a/imx_uart.c +++ b/imx_uart.c @@ -293,7 +293,7 @@ int parse_opts(int argc, char * const *argv, char const **ttyfile, char const **conffile, int *verify, int *usertscts, int *associate, struct sdp_work **cmd_head) { - char c; + int c; *conffile = NULL; *ttyfile = NULL;