+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
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
for (buflen = 0; buflen <= buflen_max; buflen++)
{
memset (buffer, 'X', sizeof buffer);
- errno = 0;
result = ptsname_r (fd, buffer, buflen);
if (buflen > len)
{
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
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);
}
{