ptsname_r test: Avoid gcc warning on glibc systems.
authorBruno Haible <bruno@clisp.org>
Thu, 10 Nov 2011 12:56:40 +0000 (13:56 +0100)
committerBruno Haible <bruno@clisp.org>
Thu, 10 Nov 2011 12:56:40 +0000 (13:56 +0100)
* tests/test-ptsname_r.c (null_ptr): New function.
(test_errors): Use it.

ChangeLog
tests/test-ptsname_r.c

index 5ac22c2..0c4eff9 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,11 @@
 2011-11-10  Bruno Haible  <bruno@clisp.org>
 
+       ptsname_r test: Avoid gcc warning on glibc systems.
+       * tests/test-ptsname_r.c (null_ptr): New function.
+       (test_errors): Use it.
+
+2011-11-10  Bruno Haible  <bruno@clisp.org>
+
        ptsname_r: Avoid compilation error on OSF/1 5.1.
        * lib/stdlib.in.h (ptsname_r): Override if REPLACE_PTSNAME_R is 1.
        * m4/stdlib_h.m4 (gl_STDLIB_H_DEFAULTS): Initialize REPLACE_PTSNAME_R.
index 5906e2e..76521fe 100644 (file)
@@ -53,6 +53,12 @@ same_slave (const char *slave_name1, const char *slave_name2)
               && SAME_INODE (statbuf1, statbuf2)));
 }
 
+static char *
+null_ptr (void)
+{
+  return NULL;
+}
+
 static void
 test_errors (int fd, const char *slave)
 {
@@ -86,7 +92,7 @@ test_errors (int fd, const char *slave)
     }
 
   errno = 0;
-  result = ptsname_r (fd, NULL, 0);
+  result = ptsname_r (fd, null_ptr (), 0);
   ASSERT (result != 0);
   ASSERT (result == errno);
   ASSERT (errno == EINVAL);