File tree Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Expand file tree Collapse file tree 1 file changed +4
-7
lines changed Original file line number Diff line number Diff line change @@ -141,6 +141,7 @@ static int LoadSettingsVMU() {
141141 file_t fd ;
142142 int ret = 0 ;
143143 Settings_t sets ;
144+ ssize_t res ;
144145
145146 for (int i = 0 ; i < 8 ; ++ i ) {
146147 if (!(vmu = maple_enum_type (i , MAPLE_FUNC_MEMCARD ))) {
@@ -155,9 +156,9 @@ static int LoadSettingsVMU() {
155156 continue ;
156157 }
157158
158- fs_read (fd , & sets , sizeof (Settings_t ));
159+ res = fs_read (fd , & sets , sizeof (Settings_t ));
159160
160- if (sets .version != DS_SETTIGS_VERSION ) {
161+ if (res != sizeof ( Settings_t ) || sets .version != DS_SETTIGS_VERSION ) {
161162 dbglog (DBG_DEBUG , "%s: Version mismatch for %s\n" , __func__ , save_name );
162163 fs_close (fd );
163164 continue ;
@@ -192,11 +193,7 @@ static int LoadSettingsFile(const char *filename) {
192193 res = fs_read (fd , & sets , sizeof (Settings_t ));
193194 fs_close (fd );
194195
195- if (res != sizeof (Settings_t )) {
196- return 0 ;
197- }
198-
199- if (sets .version != DS_SETTIGS_VERSION ) {
196+ if (res != sizeof (Settings_t ) || sets .version != DS_SETTIGS_VERSION ) {
200197 dbglog (DBG_DEBUG , "%s: Version mismatch for %s\n" , __func__ , filename );
201198 return 0 ;
202199 }
You can’t perform that action at this time.
0 commit comments