Skip to content

imx_uart: fix option parsing on ARM and other unsigned-char systems#123

Open
anssih wants to merge 1 commit intoboundarydevices:masterfrom
anssih:fix/imx_uart-stuck-arm
Open

imx_uart: fix option parsing on ARM and other unsigned-char systems#123
anssih wants to merge 1 commit intoboundarydevices:masterfrom
anssih:fix/imx_uart-stuck-arm

Conversation

@anssih
Copy link

@anssih anssih commented Feb 24, 2022

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 anssi.hannula@bitwise.fi

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 boundarydevices#116.

Signed-off-by: Anssi Hannula <anssi.hannula@bitwise.fi>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

imx_uart with Raspberry Pi

1 participant