summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-01-03 02:51:03 +0100
committerBruno Haible <bruno@clisp.org>2011-01-03 02:51:03 +0100
commit45dda1d3990612615119ac946d2d34d3ddfa9d8c (patch)
treecbf968497fc68e39c4b60fd85ecc3caf662f8487
parent9e0325950c35c2ff5bad205eebbfaba928fdafc6 (diff)
downloadgnulib-45dda1d3990612615119ac946d2d34d3ddfa9d8c.tar.gz
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.
-rw-r--r--ChangeLog8
-rw-r--r--doc/posix-functions/getlogin_r.texi4
-rw-r--r--tests/test-getlogin_r.c8
3 files changed, 19 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 7fc47fe7f5..88554fc149 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2011-01-02 Bruno Haible <bruno@clisp.org>
+
+ 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 <bkorb@gnu.org>
* build-aux/update-copyright: doc Simon's changes
diff --git a/doc/posix-functions/getlogin_r.texi b/doc/posix-functions/getlogin_r.texi
index 66692ce2df..7c0f5bdc3c 100644
--- a/doc/posix-functions/getlogin_r.texi
+++ b/doc/posix-functions/getlogin_r.texi
@@ -29,4 +29,8 @@ Portability problems not fixed by Gnulib:
@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
index 978efa4362..2a20fd920a 100644
--- a/tests/test-getlogin_r.c
+++ b/tests/test-getlogin_r.c
@@ -78,7 +78,13 @@ main (void)
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. */