From 0e9c9921040a1d0e2aa4b820b20535f40a0d75a3 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 23 Nov 2013 13:15:07 +0000 Subject: (svn r26058) -Fix: handle the return value of a number of functions better --- src/newgrf_config.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/newgrf_config.cpp') 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) { -- cgit v1.2.3-54-g00ecf