Skip to content

Commit f7d1195

Browse files
[Fix] <components>:finsh/shell.c
When using char rt_hw_console_getchar(void), some compilers may default to returning 255 instead of the expected -1, causing the condition if(ch < 0) at F: shell.c L:519 to fail and enter an erroneous loop. Solution: Use the same int type return value as finsh_getchar Signed-off-by: Yucai Liu <[email protected]>
1 parent 898b9f1 commit f7d1195

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

components/finsh/shell.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ int finsh_getchar(void)
193193
return ch;
194194
#endif /* RT_USING_POSIX_STDIO */
195195
#else
196-
extern char rt_hw_console_getchar(void);
196+
extern int rt_hw_console_getchar(void);
197197
return rt_hw_console_getchar();
198198
#endif /* RT_USING_DEVICE */
199199
}

0 commit comments

Comments
 (0)