getlogin_r: Avoid test failure on HP-UX 11.
authorBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2011 01:51:03 +0000 (02:51 +0100)
committerBruno Haible <bruno@clisp.org>
Mon, 3 Jan 2011 01:51:03 +0000 (02:51 +0100)
* 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.

ChangeLog
doc/posix-functions/getlogin_r.texi
tests/test-getlogin_r.c

index 7fc47fe..88554fc 100644 (file)
--- 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
index 66692ce..7c0f5bd 100644 (file)
@@ -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
index 978efa4..2a20fd9 100644 (file)
@@ -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.  */