ttyread: test for EOF while reading tty

When a read operation returns 0 then it means that we arrived to the end of the
file, and new reads will return 0 unless you do some other operation such as
lseek(). This case happens with USB-232 adapters when they are unplugged.
This commit is contained in:
Internal Server Error - Gitea: Git with a cup of tea and freedom
500 Internal Server Error

Gitea Version: 1.28.0+dev-505-g31b4d79a84