When slave side of pty is not opened,
strace on the process, which does
read(master_fd, &byte, 1);, shows this:
So, when nobody is connected to the slave side of pty,
read() waits for data - it does not return with a error.
But when slave side of pty is opened by a process and that process exits, the
read() dies with this:
read(3, 0xbf8ba7f3, 1) = -1 EIO (Input/output error)
The pty is created with
master_fd = posix_openpt(O_RDWR|O_NOCTTY)
Slave side of the pty is opened with
comfd = open(COM_PORT, O_RDWR|O_NOCTTY)
read() exits when process which opened slave side of the pty exits? Where is this described?