From 09f3117fd165af6b9f9c88bd5d404ebae57b89af Mon Sep 17 00:00:00 2001 From: folkert van heusden Date: Sun, 28 Apr 2024 01:27:42 +0200 Subject: [PATCH] coverity: fgetc could also fail for other reasons than feof --- loaders.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/loaders.cpp b/loaders.cpp index 8752141..5a809a2 100644 --- a/loaders.cpp +++ b/loaders.cpp @@ -207,7 +207,11 @@ std::optional load_tape(bus *const b, const std::string & file) break; } - uint8_t c = fgetc(fh); + int c = fgetc(fh); + if (c == -1) { + DOLOG(warning, true, "read failure"); + break; + } #endif csum += c;