diff options
| author | Ron Yorston <rmy@pobox.com> | 2025-08-17 20:45:09 +0100 |
|---|---|---|
| committer | Ron Yorston <rmy@pobox.com> | 2025-08-17 20:45:09 +0100 |
| commit | f2e7ac8c2a0ef14f2215869a01f3346e332c57af (patch) | |
| tree | 87bbdb0f2ad1072010e8852507ce4d47654ccf19 | |
| parent | 01ff9c492111cf7d51ad074629d6e72bc69fc149 (diff) | |
| download | busybox-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.c | 2 |
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 */ |
| 1183 | int mingw_isatty(int fd) | 1183 | int 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); |
