Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'winsup/cygwin/smallprint.c')
-rw-r--r--winsup/cygwin/smallprint.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/winsup/cygwin/smallprint.c b/winsup/cygwin/smallprint.c
index 7e23d1a6d..02dfb42ea 100644
--- a/winsup/cygwin/smallprint.c
+++ b/winsup/cygwin/smallprint.c
@@ -212,11 +212,15 @@ console_printf (const char *fmt,...)
va_list ap;
DWORD done;
int count;
- extern SECURITY_ATTRIBUTES sec_none;
if (!console_handle)
- console_handle = CreateFileA ("CONOUT$", GENERIC_WRITE, FILE_SHARE_WRITE,
- &sec_none, OPEN_EXISTING, 0, 0);
+ console_handle = CreateFileA ("CON", GENERIC_WRITE,
+ FILE_SHARE_READ | FILE_SHARE_WRITE,
+ NULL, OPEN_EXISTING, 0, 0);
+
+ if (console_handle == INVALID_HANDLE_VALUE)
+ console_handle = GetStdHandle (STD_ERROR_HANDLE);
+
va_start (ap, fmt);
count = __small_vsprintf (buf, fmt, ap);
va_end (ap);