# HG changeset patch # User Bruno Haible # Date 1294019463 -3600 # Node ID 1f4b3a05962f28c434069b3dfb70eb0d40fe5052 # Parent 32d4fa9823da6510ad1f89ce4ef0cdaf83c78f9b getlogin_r: Avoid test failure on HP-UX 11. * tests/test-getlogin_r.c (main): Allow an error code EINVAL instead of ERANGE when the second argument is zero. * doc/posix-functions/getlogin_r.texi: Document the HP-UX 11 portability problem. diff --git a/ChangeLog b/ChangeLog --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2011-01-02 Bruno Haible + + getlogin_r: Avoid test failure on HP-UX 11. + * tests/test-getlogin_r.c (main): Allow an error code EINVAL instead of + ERANGE when the second argument is zero. + * doc/posix-functions/getlogin_r.texi: Document the HP-UX 11 + portability problem. + 2011-01-02 Bruce Korb * build-aux/update-copyright: doc Simon's changes diff --git a/doc/posix-functions/getlogin_r.texi b/doc/posix-functions/getlogin_r.texi --- a/doc/posix-functions/getlogin_r.texi +++ b/doc/posix-functions/getlogin_r.texi @@ -29,4 +29,8 @@ @item This function fails even when standard input is a tty on some platforms: HP-UX 11.11. +@item +This function fails with error code @code{EINVAL} instead of @code{ERANGE} when +the second argument is zero on some platforms: +HP-UX 11.31. @end itemize diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c --- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -78,7 +78,13 @@ size_t i; for (i = 0; i <= n; i++) - ASSERT (getlogin_r (smallbuf, i) == ERANGE); + { + err = getlogin_r (smallbuf, i); + if (i == 0) + ASSERT (err == ERANGE || err == EINVAL); + else + ASSERT (err == ERANGE); + } } /* Test with a huge buffer. */