diff options
author | rubidium <rubidium@openttd.org> | 2013-11-23 13:15:07 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2013-11-23 13:15:07 +0000 |
commit | 0e9c9921040a1d0e2aa4b820b20535f40a0d75a3 (patch) | |
tree | 6dd17568acbfb75610e9b4e248436426ead79e89 /src/newgrf_config.cpp | |
parent | b3e93d65208f74802595b12e682d98a4d534a328 (diff) | |
download | openttd-0e9c9921040a1d0e2aa4b820b20535f40a0d75a3.tar.xz |
(svn r26058) -Fix: handle the return value of a number of functions better
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r-- | src/newgrf_config.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp index 5ac8ba4df..bbd670a71 100644 --- a/src/newgrf_config.cpp +++ b/src/newgrf_config.cpp @@ -362,7 +362,11 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir) size_t start = ftell(f); size = min(size, GRFGetSizeOfDataSection(f)); - fseek(f, start, SEEK_SET); + + if (fseek(f, start, SEEK_SET) < 0) { + FioFCloseFile(f); + return false; + } /* calculate md5sum */ while ((len = fread(buffer, 1, (size > sizeof(buffer)) ? sizeof(buffer) : size, f)) != 0 && size != 0) { |