Commit 1377e3d1 authored by Tor Lillqvist's avatar Tor Lillqvist Committed by Tor Lillqvist

Check the C stdout and stderr streams for validity, instead of what

2003-01-01  Tor Lillqvist  <tml@iki.fi>

	* glib/gmessages.c (ensure_stdout_valid, ensure_stderr_valid):
	Check the C stdout and stderr streams for validity, instead of
	what GetStdHandle() returns.
parent ea092180
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -3,6 +3,8 @@
* glib/gmessages.c (ensure_stderr_valid): New function, parallel
to ensure_stdout_valid(). #defined as empty on Unix. Move the
alloc_console_called static flag inside these two functions.
(ensure_stdout_valid, ensure_stderr_valid): Check the C stdout and
stderr streams for validity, instead of what GetStdHandle() returns.
(mklevel_prefix): Do use either stderr or stdout on Windows,
too. Otherwise g_warning() messages (that are just warnings, by
definition) will get mixed with proper stdout output. Noticed in
......
......@@ -46,6 +46,7 @@
#include "gprintfint.h"
#ifdef G_OS_WIN32
#include <io.h>
typedef FILE* GFileDescriptor;
#else
typedef gint GFileDescriptor;
......@@ -129,7 +130,7 @@ ensure_stdout_valid (void)
if (!alloc_console_called)
{
handle = GetStdHandle (STD_OUTPUT_HANDLE);
handle = (HANDLE) _get_osfhandle (fileno (stdout));
if (handle == INVALID_HANDLE_VALUE)
{
......@@ -151,8 +152,8 @@ ensure_stderr_valid (void)
if (!alloc_console_called)
{
handle = GetStdHandle (STD_ERROR_HANDLE);
handle = (HANDLE) _get_osfhandle (fileno (stderr));
if (handle == INVALID_HANDLE_VALUE)
{
AllocConsole ();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment