mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/2] readline_simple: return -1 if getc fails
@ 2017-08-09  4:13 Gaël PORTAY
  2017-08-09  4:13 ` [PATCH v2 1/2] " Gaël PORTAY
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Gaël PORTAY @ 2017-08-09  4:13 UTC (permalink / raw)
  To: barebox; +Cc: Gaël PORTAY

Dear maintainers,

I came accross this issue when I was trying to add support for a new MIPS
board.

The getc() function from console_simple.c returns -EINVAL when no console is
registered.

It causes readline_simple to print a non-printable character (-EINVAL in this
case). Furthermore, it causes an infinite loop: readline never returns.

	barebox:/ ���(...)���

With this patch, the error is no more explicit but the readline function stops
to print a dummy character and returns to shell.

	barebox:/ <INTERRUPT>
	barebox:/ <INTERRUPT>
	barebox:/ <INTERRUPT>
	(...)
	barebox:/ <INTERRUPT>
	barebox:/ <INTERRUPT>
	barebox:/ <INTERRUPT>

The second patch is a simple cleanup of the in-file documentation.

Changes since v1:
 - change c variable type from char in int
 - set *p to NUL before returning -1 when getchar returns an error
 - update function documentation

Regards,
Gaël PORTAY (2):
  readline_simple: return -1 if getc fails
  readline_simple: remove obsolete documentation

 lib/readline_simple.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

-- 
2.13.2


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-08-10  5:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-08-09  4:13 [PATCH 0/2] readline_simple: return -1 if getc fails Gaël PORTAY
2017-08-09  4:13 ` [PATCH v2 1/2] " Gaël PORTAY
2017-08-09  4:13 ` [PATCH v2 2/2] readline_simple: remove obsolete documentation Gaël PORTAY
2017-08-09  6:05 ` [PATCH 0/2] readline_simple: return -1 if getc fails Oleksij Rempel
2017-08-09 18:58   ` Gaël PORTAY
2017-08-09 19:41     ` Oleksij Rempel
2017-08-10  5:51     ` Antony Pavlov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox