aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-04-03 10:41:33 +0100
committerRon Yorston <rmy@pobox.com>2018-04-03 12:29:01 +0100
commit4d8668e4b6bac0d7902dd677d540c700817b094b (patch)
tree06e7d9c9cd140df91a652992d6926f664985a1c4
parented8eb229df581c702e44a352aaf4ed47b64bf623 (diff)
downloadbusybox-w32-4d8668e4b6bac0d7902dd677d540c700817b094b.tar.gz
busybox-w32-4d8668e4b6bac0d7902dd677d540c700817b094b.tar.bz2
busybox-w32-4d8668e4b6bac0d7902dd677d540c700817b094b.zip
win32: simplify isatty replacement
Don't treat input and output file descriptors differently: if we aren't connected to a console GetConsoleMode will fail for either.
-rw-r--r--win32/winansi.c6
1 files changed, 1 insertions, 5 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index e36f7565b..ad6016ddc 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -735,7 +735,6 @@ int mingw_isatty(int fd)
735 735
736 if (result) { 736 if (result) {
737 HANDLE handle = (HANDLE) _get_osfhandle(fd); 737 HANDLE handle = (HANDLE) _get_osfhandle(fd);
738 CONSOLE_SCREEN_BUFFER_INFO sbi;
739 DWORD mode; 738 DWORD mode;
740 739
741 if (handle == INVALID_HANDLE_VALUE) 740 if (handle == INVALID_HANDLE_VALUE)
@@ -745,10 +744,7 @@ int mingw_isatty(int fd)
745 if (GetFileType(handle) != FILE_TYPE_CHAR) 744 if (GetFileType(handle) != FILE_TYPE_CHAR)
746 return 0; 745 return 0;
747 746
748 if (!fd) { 747 if (!GetConsoleMode(handle, &mode))
749 if (!GetConsoleMode(handle, &mode))
750 return 0;
751 } else if (!GetConsoleScreenBufferInfo(handle, &sbi))
752 return 0; 748 return 0;
753 } 749 }
754 750