From 8097b937c0290f60a4e78e3c9d142c174c49496d Mon Sep 17 00:00:00 2001 From: nick black Date: Sat, 28 Aug 2021 19:36:59 -0400 Subject: [PATCH] Windows: introduce tty_check() wrapper for isatty() #2098 --- src/lib/fd.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/lib/fd.c b/src/lib/fd.c index 255447e9c..ecb554c4e 100644 --- a/src/lib/fd.c +++ b/src/lib/fd.c @@ -472,7 +472,7 @@ int get_tty_fd(FILE* ttyfp){ if((fd = fileno(ttyfp)) < 0){ logwarn("No file descriptor was available in outfp %p\n", ttyfp); }else{ - if(isatty(fd)){ + if(tty_check(fd)){ fd = dup(fd); }else{ loginfo("fd %d not a TTY\n", fd); @@ -485,7 +485,7 @@ int get_tty_fd(FILE* ttyfp){ if(fd < 0){ loginfo("Error opening /dev/tty (%s)\n", strerror(errno)); }else{ - if(!isatty(fd)){ + if(!tty_check(fd)){ loginfo("File descriptor for /dev/tty (%d) is not actually a TTY\n", fd); close(fd); fd = -1;