Browse Source

Additional write check

Christoph Stelz 2 months ago
parent
commit
4bd7b5cebe
1 changed files with 6 additions and 1 deletions
  1. 6 1
      src/ipc_debug.cpp

+ 6 - 1
src/ipc_debug.cpp

@@ -155,7 +155,12 @@ void debug_ipc_assert_equal_vector(std::vector<T> value) {
         }
 
     } else {
-        fwrite(value.data(), 1, array_byte_length, debug_ipc_file);
+        size_t written = fwrite(value.data(), 1, array_byte_length, debug_ipc_file);
+
+        if (written != 1) {
+            printf("[IPCDBG] Could not write enough bytes. Error: %s\n", strerror(errno));
+            endless_loop();
+        }
     }
 }