Browse Source

MinGW: get console only once

pull/1997/head
Linus Yang 6 years ago
parent
commit
6315f6c3cd
1 changed files with 6 additions and 5 deletions
  1. 11
      src/winsock.c

11
src/winsock.c

@ -133,11 +133,12 @@ set_concolor(WORD color, BOOL reset)
static HANDLE console = NULL; static HANDLE console = NULL;
if (console == NULL) { if (console == NULL) {
console = GetStdHandle(STD_OUTPUT_HANDLE); console = GetStdHandle(STD_OUTPUT_HANDLE);
if (console == NULL ||
console == INVALID_HANDLE_VALUE) {
console = NULL;
return FALSE;
}
}
if (console == NULL ||
console == INVALID_HANDLE_VALUE) {
// If no console is available, we will not try again
console = INVALID_HANDLE_VALUE;
return FALSE;
} }
WORD attr; WORD attr;
if (!get_conattr(console, &attr)) { if (!get_conattr(console, &attr)) {

Loading…
Cancel
Save