bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

getlogin_r on HP-UX 11.31


From: Bruno Haible
Subject: getlogin_r on HP-UX 11.31
Date: Mon, 3 Jan 2011 02:51:45 +0100
User-agent: KMail/1.9.9

On HP-UX 11.23 and 11.31, I'm seeing this test failure:

  test-getlogin_r.c:81: assertion failed
  sh[10]: 19109 Abort(coredump)
  FAIL: test-getlogin_r

The reason is that getlogin_r (buf, 0) returns EINVAL instead of ERANGE
on this platform. I think it's not worth adding a workaround in gnulib,
just document it:


2011-01-02  Bruno Haible  <address@hidden>

        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.

--- doc/posix-functions/getlogin_r.texi.orig    Mon Jan  3 02:47:46 2011
+++ doc/posix-functions/getlogin_r.texi Mon Jan  3 02:47:26 2011
@@ -29,4 +29,8 @@
 @item
 This function fails even when standard input is a tty on some platforms:
 HP-UX 11.11.
address@hidden
+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
--- tests/test-getlogin_r.c.orig        Mon Jan  3 02:47:46 2011
+++ tests/test-getlogin_r.c     Mon Jan  3 02:44:03 2011
@@ -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.  */



reply via email to

[Prev in Thread] Current Thread [Next in Thread]