aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2025-08-17 20:45:09 +0100
committerRon Yorston <rmy@pobox.com>2025-08-17 20:45:09 +0100
commitf2e7ac8c2a0ef14f2215869a01f3346e332c57af (patch)
tree87bbdb0f2ad1072010e8852507ce4d47654ccf19
parent01ff9c492111cf7d51ad074629d6e72bc69fc149 (diff)
downloadbusybox-w32-f2e7ac8c2a0ef14f2215869a01f3346e332c57af.tar.gz
busybox-w32-f2e7ac8c2a0ef14f2215869a01f3346e332c57af.tar.bz2
busybox-w32-f2e7ac8c2a0ef14f2215869a01f3346e332c57af.zip
win32: fix return value of isatty()
Changes to the ls applet upstream assumed that the return value of isatty() followed the C standard and would be 0 or 1. The wrapper for Windows' _isatty() didn't allow for it returning a non-zero value for a tty, not 1. This confused ls. Fix the wrapper. (GitHub issue #513)
-rw-r--r--win32/winansi.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/win32/winansi.c b/win32/winansi.c
index 9736f0568..427c71f11 100644
--- a/win32/winansi.c
+++ b/win32/winansi.c
@@ -1182,7 +1182,7 @@ char *winansi_fgets(char *s, int size, FILE *stream)
1182/* Ensure that isatty(fd) returns 0 for the NUL device */ 1182/* Ensure that isatty(fd) returns 0 for the NUL device */
1183int mingw_isatty(int fd) 1183int mingw_isatty(int fd)
1184{ 1184{
1185 int result = _isatty(fd); 1185 int result = _isatty(fd) != 0;
1186 1186
1187 if (result) { 1187 if (result) {
1188 HANDLE handle = (HANDLE) _get_osfhandle(fd); 1188 HANDLE handle = (HANDLE) _get_osfhandle(fd);