*nix: Fix unexpected clear errno when I/O failed


This bug was detected on MacOSX 10.8 & FTDI serial device.

When removing a previously opened device from the system, triggered
readNotifier() and are trying to read() from the device, but call
returns -1 with errno = 6. It is correct behavior.

But then, when called decodeSystemError(), the now value of errno
is zero, so this method incorrect detect error as NoError.

This reset errno is due to the fact that between calls to read() and
decodeSystemError(), there are other system calls that are implemented
within QRingBuffer (e.g. access to memory).

Therefore, must do decodeSystemError() immediately after the failed
I/O calls, so need to move decodeSystemError() near to I/O calls.

Change-Id: Iad7e78247cf81a0a6ed5053ee996728881414558
Reviewed-by: Laszlo Papp <lpapp@kde.org>
commit0d5d7cb9b5bcebec79b2de6acb43da1b05ad82f6
parentfeae6e4634e18516e4f64a20d55f98f40a20cd9e
authorDenis Shienkov <denis.shienkov@gmail.com>
committerThe Qt Project <gerrit-noreply@qt-project.org>
commit timeSat, 2 Mar 2013 18:47:29 +0100