diff options
author | Ken Brown <kbrown@cornell.edu> | 2021-01-20 12:01:13 -0500 |
---|---|---|
committer | Ken Brown <kbrown@cornell.edu> | 2021-01-22 10:36:43 -0500 |
commit | a60a4501b77dca8f30e01327b96171ee89c278f7 (patch) | |
tree | e5feabd9bf66d0d48ce03b677c7f3bbcc9052ec6 | |
parent | 4aefad2bb827afa273fcd768bd06dd618d41ae75 (diff) | |
download | newlib-a60a4501b77dca8f30e01327b96171ee89c278f7.zip newlib-a60a4501b77dca8f30e01327b96171ee89c278f7.tar.gz newlib-a60a4501b77dca8f30e01327b96171ee89c278f7.tar.bz2 |
Cygwin: ptsname_r: always return an error number on failure
Return EBADF on a bad file descriptor. Previously 0 was returned, in
violation of the requirement in
https://man7.org/linux/man-pages/man3/ptsname_r.3.html that an error
number should be returned on failure.
We are intentionally deviating from Linux, on which ENOTTY is
returned.
Addresses: https://lists.gnu.org/archive/html/bug-gnulib/2021-01/msg00245.html
-rw-r--r-- | winsup/cygwin/release/3.2.0 | 3 | ||||
-rw-r--r-- | winsup/cygwin/syscalls.cc | 2 |
2 files changed, 4 insertions, 1 deletions
diff --git a/winsup/cygwin/release/3.2.0 b/winsup/cygwin/release/3.2.0 index 43725ce..f748a9b 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 7044ea9..c985142 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); } |