diff options
| author | Petr Mrázek | 2011-11-04 09:08:29 +0100 |
|---|---|---|
| committer | Petr Mrázek | 2011-11-04 09:08:29 +0100 |
| commit | af46b262b532400d1ff0ce176a969aa6d397193d (patch) | |
| tree | 74380908f0eef2d84c0b53a857d4c89d34584327 /library/Console-linux.cpp | |
| parent | 0ff7a48848945583f00671b1da9bbd9d16e1f33f (diff) | |
| download | dfhack-af46b262b532400d1ff0ce176a969aa6d397193d.tar.gz dfhack-af46b262b532400d1ff0ce176a969aa6d397193d.tar.bz2 dfhack-af46b262b532400d1ff0ce176a969aa6d397193d.tar.xz | |
More init hardening.
Diffstat (limited to 'library/Console-linux.cpp')
| -rw-r--r-- | library/Console-linux.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/library/Console-linux.cpp b/library/Console-linux.cpp index d74c4804..e15a6e9c 100644 --- a/library/Console-linux.cpp +++ b/library/Console-linux.cpp @@ -640,7 +640,6 @@ bool Console::init(bool sharing) return false; } freopen("stdout.log", "w", stdout); - freopen("stderr.log", "w", stderr); d = new Private(); // make our own weird streams so our IO isn't redirected d->dfout_C = fopen("/dev/tty", "w"); @@ -690,11 +689,18 @@ int Console::printerr( const char* format, ... ) va_list args; lock_guard <mutex> g(*wlock); int ret; - if(!inited) ret = -1; + // also mirror in error log + if(!inited) + { + va_start( args, format ); + ret = vfprintf(stderr, format, args); + va_end(args); + } else { va_start( args, format ); ret = d->vprinterr(format, args); + vfprintf(stderr, format, args); va_end(args); } return ret; |
