summaryrefslogtreecommitdiff
path: root/src/newgrf_config.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2013-11-23 13:17:45 +0000
committerrubidium <rubidium@openttd.org>2013-11-23 13:17:45 +0000
commit78a316d349f02c76b89c6fd7597e7013c062133a (patch)
treef9ed8c8d687f7081d6de04c70a82060d4ed2f040 /src/newgrf_config.cpp
parent29ef70c246293ebde72f36e0a01483eeac6f7fdf (diff)
downloadopenttd-78a316d349f02c76b89c6fd7597e7013c062133a.tar.xz
(svn r26061) -Fix: negative result of ftell wasn't handled correctly in some cases
Diffstat (limited to 'src/newgrf_config.cpp')
-rw-r--r--src/newgrf_config.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/newgrf_config.cpp b/src/newgrf_config.cpp
index bbd670a71..df8685030 100644
--- a/src/newgrf_config.cpp
+++ b/src/newgrf_config.cpp
@@ -360,10 +360,10 @@ static bool CalcGRFMD5Sum(GRFConfig *config, Subdirectory subdir)
f = FioFOpenFile(config->filename, "rb", subdir, &size);
if (f == NULL) return false;
- size_t start = ftell(f);
+ long start = ftell(f);
size = min(size, GRFGetSizeOfDataSection(f));
- if (fseek(f, start, SEEK_SET) < 0) {
+ if (start < 0 || fseek(f, start, SEEK_SET) < 0) {
FioFCloseFile(f);
return false;
}