Eric Blake wrote: > +static int > +test_errors (int fd, const char *slave)
On Cygwin and mingw I'm seeing this warning: test-ptsname_r.c: In function `test_errors': test-ptsname_r.c:89: warning: control reaches end of non-void function On MacOS X 10.5 I'm seeing this failure: test-ptsname_r.c:72: assertion failed FAIL: test-ptsname_r Cause: ptsname_r failed with ERANGE. Once this is fixed, I get: $ ./test-ptsname_r Alarm clock Cause: There are too many ptsname_r calls. I'm applying this fix. It reduces the runtime (on MacOS X 10.5) to ca. 1.2 sec. 2011-11-09 Bruno Haible <br...@clisp.org> ptsname_r tests: Fix bugs. * tests/test-ptsname_r.c (test_errors): Change return type to 'void'. Fix ptsname_r calls. Reduce loop rounds to a reasonable amount. --- tests/test-ptsname_r.c.orig Thu Nov 10 02:38:37 2011 +++ tests/test-ptsname_r.c Thu Nov 10 02:37:24 2011 @@ -53,20 +53,24 @@ && SAME_INODE (statbuf1, statbuf2))); } -static int +static void test_errors (int fd, const char *slave) { char buffer[256]; size_t len; - int result; + size_t buflen_max; size_t buflen; + int result; len = strlen (slave); - for (buflen = 0; buflen <= sizeof buffer; buflen++) + buflen_max = len + 5; + if (buflen_max > sizeof buffer) + buflen_max = sizeof buffer; + for (buflen = 0; buflen <= buflen_max; buflen++) { - errno = 0; memset (buffer, 'X', sizeof buffer); - result = ptsname_r (fd, buffer, len); + errno = 0; + result = ptsname_r (fd, buffer, buflen); if (buflen > len) { ASSERT (result == 0); -- In memoriam Robert Blum <http://en.wikipedia.org/wiki/Robert_Blum>