shithub: choc

Download patch

ref: 52bf4884aa627fbd0bb3cd6e9602991b3ba5b5c1
parent: 41b772f1e4771798c1af76e13103a07ec25ca204
author: Turo Lamminen <turotl@gmail.com>
date: Sat Jan 6 10:11:29 EST 2018

doom: Don't ignore return value of fread() call

--- a/src/doom/m_menu.c
+++ b/src/doom/m_menu.c
@@ -510,6 +510,7 @@
 
     for (i = 0;i < load_end;i++)
     {
+        int retval;
         M_StringCopy(name, P_SaveGameFile(i), sizeof(name));
 
 	handle = fopen(name, "rb");
@@ -519,9 +520,9 @@
             LoadMenu[i].status = 0;
             continue;
         }
-	fread(&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
+        retval = fread(&savegamestrings[i], 1, SAVESTRINGSIZE, handle);
 	fclose(handle);
-	LoadMenu[i].status = 1;
+        LoadMenu[i].status = retval == SAVESTRINGSIZE;
     }
 }