diff -Naur glib-2.46.0-orig/glib/gmessages.c glib-2.46.0/glib/gmessages.c
--- glib-2.46.0-orig/glib/gmessages.c	2015-09-22 09:09:00.356212800 +0300
+++ glib-2.46.0/glib/gmessages.c	2015-09-22 09:09:01.292110800 +0300
@@ -932,7 +932,7 @@
   if ((log_level & G_LOG_FLAG_FATAL) != 0 && !g_test_initialized ())
     win32_keep_fatal_message = TRUE;
 #endif
-  return to_stdout ? 1 : 2;
+  return to_stdout ? fileno(stdout) : fileno(stderr);
 }
 
 typedef struct {
