diff options
author | rubidium <rubidium@openttd.org> | 2008-05-05 21:54:05 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2008-05-05 21:54:05 +0000 |
commit | f2683a603715c16e1fa8a4ab321d52a5d63ef251 (patch) | |
tree | b6a7a87880602d6ced468583c62ce83fa3de9653 /src/console.cpp | |
parent | 15ebb1a29202c95a1bd5ab8d852c2ae6b886baac (diff) | |
download | openttd-f2683a603715c16e1fa8a4ab321d52a5d63ef251.tar.xz |
(svn r12960) -Codechange: handle return values of (some) file system related functions.
Diffstat (limited to 'src/console.cpp')
-rw-r--r-- | src/console.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/console.cpp b/src/console.cpp index 00e471e12..c1bb05676 100644 --- a/src/console.cpp +++ b/src/console.cpp @@ -271,8 +271,12 @@ static void IConsoleWriteToLogFile(const char *string) { if (_iconsole_output_file != NULL) { /* if there is an console output file ... also print it there */ - fwrite(string, strlen(string), 1, _iconsole_output_file); - fwrite("\n", 1, 1, _iconsole_output_file); + if (fwrite(string, strlen(string), 1, _iconsole_output_file) != 1 || + fwrite("\n", 1, 1, _iconsole_output_file) != 1) { + fclose(_iconsole_output_file); + _iconsole_output_file = NULL; + IConsolePrintF(_icolour_def, "cannot write to log file"); + } } } |