diff --git a/winsup/cygwin/release/3.2.0 b/winsup/cygwin/release/3.2.0 index 43725cec2..f748a9bc8 100644 --- a/winsup/cygwin/release/3.2.0 +++ b/winsup/cygwin/release/3.2.0 @@ -52,3 +52,6 @@ Bug Fixes - Fix the errno when a path contains .. and the prefix exists but is not a directory. Addresses: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00214.html + +- Fix the return value when ptsname_r(3) is called with a bad file descriptor + Addresses: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00245.html diff --git a/winsup/cygwin/syscalls.cc b/winsup/cygwin/syscalls.cc index 7044ea903..c985142eb 100644 --- a/winsup/cygwin/syscalls.cc +++ b/winsup/cygwin/syscalls.cc @@ -3392,7 +3392,7 @@ ptsname_r (int fd, char *buf, size_t buflen) cygheap_fdget cfd (fd); if (cfd < 0) - return 0; + return EBADF; return cfd->ptsname_r (buf, buflen); }