From c6da145f0f9a4e3fde65bd2357a8fd86bca12f67 Mon Sep 17 00:00:00 2001 From: akuker <34318535+akuker@users.noreply.github.com> Date: Fri, 26 Aug 2022 03:19:42 -0500 Subject: [PATCH] handle the return value of write() (#810) Co-authored-by: Tony Kuker --- src/raspberrypi/devices/scsi_printer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/raspberrypi/devices/scsi_printer.cpp b/src/raspberrypi/devices/scsi_printer.cpp index f00a84ac..2711596f 100644 --- a/src/raspberrypi/devices/scsi_printer.cpp +++ b/src/raspberrypi/devices/scsi_printer.cpp @@ -257,9 +257,9 @@ bool SCSIPrinter::WriteBytes(BYTE *buf, uint32_t length) LOGTRACE("Appending %d byte(s) to printer output file", length); - write(fd, buf, length); + uint32_t num_written = write(fd, buf, length); - return true; + return (num_written == length); } bool SCSIPrinter::CheckReservation(SCSIDEV *controller)