(svn r26058) -Fix: handle the return value of a number of functions better
This commit is contained in:
@@ -250,10 +250,9 @@ static SavegameType DetermineOldSavegameType(FILE *f, char *title, const char *l
|
||||
|
||||
/* Can't fseek to 0 as in tar files that is not correct */
|
||||
long pos = ftell(f);
|
||||
if (!CheckOldSavegameType(f, temp, lastof(temp), TTO_HEADER_SIZE)) {
|
||||
if (pos >= 0 && !CheckOldSavegameType(f, temp, lastof(temp), TTO_HEADER_SIZE)) {
|
||||
type = SGT_TTD;
|
||||
fseek(f, pos, SEEK_SET);
|
||||
if (!CheckOldSavegameType(f, temp, lastof(temp), TTD_HEADER_SIZE)) {
|
||||
if (fseek(f, pos, SEEK_SET) < 0 || !CheckOldSavegameType(f, temp, lastof(temp), TTD_HEADER_SIZE)) {
|
||||
type = SGT_INVALID;
|
||||
}
|
||||
}
|
||||
|
@@ -1848,7 +1848,9 @@ struct FileReader : LoadFilter {
|
||||
/* virtual */ void Reset()
|
||||
{
|
||||
clearerr(this->file);
|
||||
fseek(this->file, this->begin, SEEK_SET);
|
||||
if (fseek(this->file, this->begin, SEEK_SET)) {
|
||||
DEBUG(sl, 1, "Could not reset the file reading");
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Reference in New Issue
Block a user