On 05/22/2014 04:39 PM, Tom G. Christensen wrote:
> On 19/05/14 14:37, Pádraig Brady wrote:
>> FYI I just pushed the attached to sync test-getlogin_r.c
>> with the recent changes in test-getlogin.c
>>
> 
> This broke the build on CentOS 6.
> 
> depbase=`echo test-getlogin_r.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
>         gcc -std=gnu99 -DHAVE_CONFIG_H -I.  -DGNULIB_STRICT_CHECKING=1 -I. 
> -I. -I.. -I./.. -I../gllib -I./../gllib   -g -O2 -Wall -MT test-getlogin_r.o 
> -MD -MP -MF $depbase.Tpo -c -o test-getlogin_r.o test-getlogin_r.c &&\
>         mv -f $depbase.Tpo $depbase.Po
> test-getlogin_r.c: In function 'main':
> test-getlogin_r.c:68: error: storage size of 'stat_buf' isn't known

Drats sorry. This shows up when the ttyname_r module is also used,
thus setting HAVE_TTYNAME (which I forgot to do), thus triggering
the invalid test code.

I've fixed this up in the attached and pushed.

sorry for the trouble.

Pádraig.
>From 11167af9538fb8526d30784ae048d45d1abc83b2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?P=C3=A1draig=20Brady?= <p...@draigbrady.com>
Date: Thu, 22 May 2014 17:09:49 +0100
Subject: [PATCH] getlogin_r-tests: fix various issues in recent change

* tests/test-getlogin_r.c: Include required headers that were
missed in recent commit eec20b4e.
Also consistently check the errno rather than the return value from
getlogin_r as POSIX only specifies that non zero is returned on error.
* modules/getlogin_r-tests (configure.ac): Add the check for ttyname().
---
 ChangeLog                |    9 +++++++++
 modules/getlogin_r-tests |    1 +
 tests/test-getlogin_r.c  |    7 ++++++-
 3 files changed, 16 insertions(+), 1 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 35ddc05..aa34350 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2014-05-22  Pádraig Brady  <p...@draigbrady.com>
+
+	getlogin_r-tests: fix various issues in recent change
+	* tests/test-getlogin_r.c: Include required headers that were
+	missed in recent commit eec20b4e.
+	Also consistently check the errno rather than the return value from
+	getlogin_r as POSIX only specifies that non zero is returned on error.
+	* modules/getlogin_r-tests (configure.ac): Add the check for ttyname().
+
 2014-05-21  Paul Eggert  <egg...@cs.ucla.edu>
 
 	fchdir: port 'open' and 'close' redefinitions to AIX 7.1
diff --git a/modules/getlogin_r-tests b/modules/getlogin_r-tests
index 22dfba5..eda7b45 100644
--- a/modules/getlogin_r-tests
+++ b/modules/getlogin_r-tests
@@ -6,6 +6,7 @@ tests/macros.h
 Depends-on:
 
 configure.ac:
+AC_CHECK_FUNCS_ONCE([ttyname])
 
 Makefile.am:
 TESTS += test-getlogin_r
diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c
index fb3f9bf..5c7078d 100644
--- a/tests/test-getlogin_r.c
+++ b/tests/test-getlogin_r.c
@@ -27,6 +27,11 @@ SIGNATURE_CHECK (getlogin_r, int, (char *, size_t));
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
+#include <pwd.h>
+
+#include <sys/stat.h>
+#include <sys/types.h>
 
 #include "macros.h"
 
@@ -48,7 +53,7 @@ main (void)
         }
 
       /* getlogin_r() fails when stdin is not connected to a tty.  */
-      ASSERT (err == ENOTTY
+      ASSERT (errno == ENOTTY
               || errno == EINVAL /* seen on Linux/SPARC */
               || errno == ENXIO
              );
-- 
1.7.7.6

Reply via email to