]> git.baikalelectronics.ru Git - uboot.git/commit
tools: kwboot: Fix quitting terminal
authorPali Rohár <pali@kernel.org>
Fri, 18 Feb 2022 11:24:13 +0000 (12:24 +0100)
committerStefan Roese <sr@denx.de>
Fri, 4 Mar 2022 07:38:05 +0000 (08:38 +0100)
commit02b9d518b2e86e107351e4ee2f49de2fbb175a47
tree1781128ca976857a8cee4298d964074cf8ca0513
parent840d87e7f792bd6bae5178b38210a38f9ca778b1
tools: kwboot: Fix quitting terminal

Sometimes kwboot after quitting terminal prints error message:

  terminal: Bad address

This is caused by trying to call write() syscall with count of (size_t)-1
bytes.

When quit sequence is split into more read() calls then number of input
bytes (nin) at the end of cycle can underflow and be negative. Fix it.

Fixes: c0b6d92933a8 ("tools: kwboot: Fix detection of quit esc sequence")
Signed-off-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Stefan Roese <sr@denx.de>
tools/kwboot.c