summaryrefslogtreecommitdiff
path: root/src/console.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/console.cpp')
-rw-r--r--src/console.cpp8
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");
+ }
}
}