shithub: choc

Download patch

ref: 091fdce05986d001d3bea0c5406572b8d933b409
parent: 52bf4884aa627fbd0bb3cd6e9602991b3ba5b5c1
author: Turo Lamminen <turotl@gmail.com>
date: Sat Jan 6 10:20:48 EST 2018

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

--- a/src/heretic/mn_menu.c
+++ b/src/heretic/mn_menu.c
@@ -642,6 +642,7 @@
 
     for (i = 0; i < 6; i++)
     {
+        int retval;
         filename = SV_Filename(i);
         fp = fopen(filename, "rb+");
 	free(filename);
@@ -652,9 +653,9 @@
             SlotStatus[i] = 0;
             continue;
         }
-        fread(&SlotText[i], 1, SLOTTEXTLEN, fp);
+        retval = fread(&SlotText[i], 1, SLOTTEXTLEN, fp);
         fclose(fp);
-        SlotStatus[i] = 1;
+        SlotStatus[i] = retval == SLOTTEXTLEN;
     }
     slottextloaded = true;
 }