summaryrefslogtreecommitdiff
path: root/indra/newview/llappviewerwin32.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'indra/newview/llappviewerwin32.cpp')
-rw-r--r--indra/newview/llappviewerwin32.cpp39
1 files changed, 30 insertions, 9 deletions
diff --git a/indra/newview/llappviewerwin32.cpp b/indra/newview/llappviewerwin32.cpp
index d328567a0e..b9d546de59 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) :