]> Savannah Git Hosting - gnulib.git/commitdiff
ptsname_r: Don't expect that this function sets errno.
authorBruno Haible <bruno@clisp.org>
Sat, 24 Feb 2018 09:53:24 +0000 (10:53 +0100)
committerBruno Haible <bruno@clisp.org>
Sat, 24 Feb 2018 09:53:24 +0000 (10:53 +0100)
* 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.

ChangeLog
doc/glibc-functions/ptsname_r.texi
tests/test-ptsname_r.c

index 6c51a009bab4d60cdfd989ed2d474b400bbd599b..66996fa90ab50ba14900e83e88daa33dae86c15d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -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
index 810908507a38a6fa0e5e374c0bfe2f1017792a8d..979a0904bd8e36941f5d9550409582ad424b9135 100644 (file)
@@ -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
index ca313d10b093a31481e72c9fcc43a26412310e05..dcbecc43025442c893af039e212b15aa5b0c1a91 100644 (file)
@@ -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);
   }
 
   {