diff options
author | Johannes Schickel | 2008-08-16 22:30:47 +0000 |
---|---|---|
committer | Johannes Schickel | 2008-08-16 22:30:47 +0000 |
commit | 388b3f0296f0a55b40017c5a1ad2b722218bd8a9 (patch) | |
tree | 606686c9fbe8535f254ec66680ed6b23ee74b9f9 /backends/platform/sdl | |
parent | cc82aeb18d9c5945560bdc2251d5b3c7147db9a5 (diff) | |
download | scummvm-rg350-388b3f0296f0a55b40017c5a1ad2b722218bd8a9.tar.gz scummvm-rg350-388b3f0296f0a55b40017c5a1ad2b722218bd8a9.tar.bz2 scummvm-rg350-388b3f0296f0a55b40017c5a1ad2b722218bd8a9.zip |
Properly close files opened when checking for config file on WIN32.
svn-id: r33953
Diffstat (limited to 'backends/platform/sdl')
-rw-r--r-- | backends/platform/sdl/sdl.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/backends/platform/sdl/sdl.cpp b/backends/platform/sdl/sdl.cpp index 5c3b87309d..539b34b78b 100644 --- a/backends/platform/sdl/sdl.cpp +++ b/backends/platform/sdl/sdl.cpp @@ -292,12 +292,13 @@ static Common::String getDefaultConfigFileName() { CreateDirectory(configFile, NULL); strcat(configFile, "\\" DEFAULT_CONFIG_FILE); - if (fopen(configFile, "r") == NULL) { + FILE *tmp = NULL; + if ((tmp = fopen(configFile, "r")) == NULL) { // Check windows directory char oldConfigFile[MAXPATHLEN]; GetWindowsDirectory(oldConfigFile, MAXPATHLEN); strcat(oldConfigFile, "\\" DEFAULT_CONFIG_FILE); - if (fopen(oldConfigFile, "r")) { + if ((tmp = fopen(oldConfigFile, "r"))) { printf("The default location of the config file (scummvm.ini) in ScummVM has changed,\n"); printf("under Windows NT4/2000/XP/Vista. You may want to consider moving your config\n"); printf("file from the old default location:\n"); @@ -305,7 +306,11 @@ static Common::String getDefaultConfigFileName() { printf("to the new default location:\n"); printf("%s\n\n", configFile); strcpy(configFile, oldConfigFile); + + fclose(tmp); } + } else { + fclose(tmp); } } else { // Check windows directory |