diff options
author | Bruno Haible <bruno@clisp.org> | 2018-02-24 10:53:24 +0100 |
---|---|---|
committer | Bruno Haible <bruno@clisp.org> | 2018-02-24 10:53:24 +0100 |
commit | 262981295f31caebf08b2bfc30bf40239e117d7d (patch) | |
tree | 75d6620cdb5cc45508bd1dc018a884c86f1e1ba8 | |
parent | 9ce5bc4970fb44573fc52d8f885f831cf09f8768 (diff) | |
download | gnulib-262981295f31caebf08b2bfc30bf40239e117d7d.tar.gz |
ptsname_r: Don't expect that this function sets errno.
* tests/test-ptsname_r.c (test_errors): Don't test errno after return
from ptsname_r().
* doc/glibc-functions/ptsname_r.texi: Mention the issue.
-rw-r--r-- | ChangeLog | 7 | ||||
-rw-r--r-- | doc/glibc-functions/ptsname_r.texi | 4 | ||||
-rw-r--r-- | tests/test-ptsname_r.c | 12 |
3 files changed, 14 insertions, 9 deletions
@@ -1,3 +1,10 @@ +2018-02-24 Bruno Haible <bruno@clisp.org> + + ptsname_r: Don't expect that this function sets errno. + * tests/test-ptsname_r.c (test_errors): Don't test errno after return + from ptsname_r(). + * doc/glibc-functions/ptsname_r.texi: Mention the issue. + 2018-02-23 Bruno Haible <bruno@clisp.org> xmalloca: pacify gcc -Wbad-function-cast diff --git a/doc/glibc-functions/ptsname_r.texi b/doc/glibc-functions/ptsname_r.texi index 810908507a..979a0904bd 100644 --- a/doc/glibc-functions/ptsname_r.texi +++ b/doc/glibc-functions/ptsname_r.texi @@ -22,4 +22,8 @@ OSF/1 5.1. Portability problems not fixed by Gnulib: @itemize +@item +When this functions fails, it provides the error code only as the +return value, without setting @code{errno}, on some platforms: +musl libc. @end itemize diff --git a/tests/test-ptsname_r.c b/tests/test-ptsname_r.c index ca313d10b0..dcbecc4302 100644 --- a/tests/test-ptsname_r.c +++ b/tests/test-ptsname_r.c @@ -70,7 +70,6 @@ test_errors (int fd, const char *slave) for (buflen = 0; buflen <= buflen_max; buflen++) { memset (buffer, 'X', sizeof buffer); - errno = 0; result = ptsname_r (fd, buffer, buflen); if (buflen > len) { @@ -80,17 +79,14 @@ test_errors (int fd, const char *slave) else { ASSERT (result != 0); - ASSERT (result == errno); - ASSERT (errno == ERANGE); + ASSERT (result == ERANGE); ASSERT (buffer[0] == 'X'); } } - errno = 0; result = ptsname_r (fd, null_ptr (), 0); ASSERT (result != 0); - ASSERT (result == errno); - ASSERT (errno == EINVAL); + ASSERT (result == EINVAL); } int @@ -108,11 +104,9 @@ main (void) char buffer[256]; int result; - errno = 0; result = ptsname_r (-1, buffer, sizeof buffer); ASSERT (result != 0); - ASSERT (result == errno); - ASSERT (errno == EBADF || errno == ENOTTY); + ASSERT (result == EBADF || result == ENOTTY); } { |