diff options
author | Dave SIMmONs <simon@lindenlab.com> | 2011-03-07 17:16:16 -0800 |
---|---|---|
committer | Dave SIMmONs <simon@lindenlab.com> | 2011-03-07 17:16:16 -0800 |
commit | 9a9f813c2f1292942c8cc8fcde9c48ed2ca31f42 (patch) | |
tree | 852ec655d36ea17968dca82701031dbba820484d /indra/newview | |
parent | 30a772c5f190827d10a552fccee0252765be429a (diff) |
Added some error checking, because s*** happens.
Diffstat (limited to 'indra/newview')
-rw-r--r-- | indra/newview/llappviewerwin32.cpp | 41 |
1 files changed, 32 insertions, 9 deletions
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp index d328567a0e..2fbec6e49e 100644 --- a/indra/newview/llappviewerwin32.cpp +++ b/indra/newview/llappviewerwin32.cpp @@ -301,23 +301,44 @@ void create_console() // redirect unbuffered STDOUT to the console l_std_handle = (long)GetStdHandle(STD_OUTPUT_HANDLE); h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - fp = _fdopen( h_con_handle, "w" ); - *stdout = *fp; - setvbuf( stdout, NULL, _IONBF, 0 ); + if (h_con_handle == -1) + { + llwarns << "create_console() failed to open stdout handle" << llendl; + } + else + { + fp = _fdopen( h_con_handle, "w" ); + *stdout = *fp; + setvbuf( stdout, NULL, _IONBF, 0 ); + } // redirect unbuffered STDIN to the console l_std_handle = (long)GetStdHandle(STD_INPUT_HANDLE); h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - fp = _fdopen( h_con_handle, "r" ); - *stdin = *fp; - setvbuf( stdin, NULL, _IONBF, 0 ); + if (h_con_handle == -1) + { + llwarns << "create_console() failed to open stdin handle" << llendl; + } + else + { + fp = _fdopen( h_con_handle, "r" ); + *stdin = *fp; + setvbuf( stdin, NULL, _IONBF, 0 ); + } // redirect unbuffered STDERR to the console l_std_handle = (long)GetStdHandle(STD_ERROR_HANDLE); h_con_handle = _open_osfhandle(l_std_handle, _O_TEXT); - fp = _fdopen( h_con_handle, "w" ); - *stderr = *fp; - setvbuf( stderr, NULL, _IONBF, 0 ); + if (h_con_handle == -1) + { + llwarns << "create_console() failed to open stderr handle" << llendl; + } + else + { + fp = _fdopen( h_con_handle, "w" ); + *stderr = *fp; + setvbuf( stderr, NULL, _IONBF, 0 ); + } } LLAppViewerWin32::LLAppViewerWin32(const char* cmd_line) : @@ -363,8 +384,10 @@ bool LLAppViewerWin32::initLogging() void LLAppViewerWin32::initConsole() { + llinfos << "Test before create_console" << llendl; // pop up debug console create_console(); + llinfos << "Test after create_console" << llendl; return LLAppViewer::initConsole(); } |