Prevent misuse of stale errno value in QSerialPort read notifier


Unix syscalls don't modify the value of errno unless they are returning
an error code. Thus it is important to check that value only after
receiving an erroenus syscall result. The readNotification() which
handles incoming serial port data should not treat read() returning
0 as an error - it is not an error and it doesn't update the errno.
Consequently, zero-length reads (ie. no data currently available)
would use the errno value set by any previous failed syscall. In some
cases it led to disabling the read notifier and complete stall of the
incoming data stream. Now the zero-length read is handled separately
which avoids that problem.

Pick-to: 6.7 6.6 6.5 6.2 5.15
Change-Id: I851aff0be7220f8a8f6418ddd40abbdf70d1382b
Reviewed-by: Ivan Solovev <ivan.solovev@qt.io>
commitc59c317cb8f6c65de6668ba01d61d78feb7d4b9f
parent584d0cf335c2c56bfc1cf9f10aa21ea927efae18
authorJaroslaw Kubik <jarek@froglogic.com>
committerJaroslaw Kubik <jarek@froglogic.com>
commit timeTue, 19 Mar 2024 12:43:24 +0100