serial: Fix file read/write error handling for Windows
File read/write semantics are different between POSIX and Windows. In
particular Windows file read/write functions return a boolean type to
indicate success or failure, while the POSIX equivalents return a
signed integer indicating number of bytes read if successful or -1 if
not.
This attempts to correct some error handling paths for Windows and
avoid invalid comparisons that were causing compilation issues.
Reported on https://github.com/flashrom/flashrom/issues/149
Change-Id: Ib179d51ede2dbd38f54f3641bfe90340a6a87e31
Signed-off-by: David Hendricks <david.hendricks@gmail.com>
Original-Reviewed-on: https://review.coreboot.org/c/flashrom/+/43051
Original-Reviewed-by: Angel Pons <th3fanbus@gmail.com>
Reviewed-on: https://review.coreboot.org/c/flashrom-stable/+/71314
Reviewed-by: Nico Huber <nico.h@gmx.de>
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Angel Pons <th3fanbus@gmail.com>
1 file changed