From b99ce3845e863894e918b483f80ffbb1e9f91252 Mon Sep 17 00:00:00 2001
From: Rangi42 <sylvie.oukaour+rangi42@gmail.com>
Date: Sun, 29 Dec 2024 13:09:37 -0500
Subject: [PATCH] Fix RGBFIX writing bytes when one syscall is not sufficient

---
 src/fix/main.cpp | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/src/fix/main.cpp b/src/fix/main.cpp
index ce9a1d8d8..06a3a88a2 100644
--- a/src/fix/main.cpp
+++ b/src/fix/main.cpp
@@ -805,13 +805,11 @@ static ssize_t writeBytes(int fd, uint8_t *buf, size_t len) {
 
 		if (ret == -1 && errno != EINTR) // Return errors, unless we only were interrupted
 			return -1;
-		// EOF reached
-		if (ret == 0)
-			return total;
-		// If anything was read, accumulate it, and continue
+		// If anything was written, accumulate it, and continue
 		if (ret != -1) {
 			total += ret;
 			len -= ret;
+			buf += ret;
 		}
 	}
 
