From: Pádraig Brady Date: Thu, 22 May 2014 16:09:49 +0000 (+0100) Subject: getlogin_r-tests: fix various issues in recent change X-Git-Tag: v1.0~7380 X-Git-Url: https://gitweb.git.savannah.gnu.org/gitweb/?a=commitdiff_plain;h=11167af9538fb8526d30784ae048d45d1abc83b2;p=gnulib.git 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(). --- diff --git a/ChangeLog b/ChangeLog index 35ddc055dd..aa3435059d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2014-05-22 Pádraig Brady + + 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 fchdir: port 'open' and 'close' redefinitions to AIX 7.1 diff --git a/modules/getlogin_r-tests b/modules/getlogin_r-tests index 22dfba5439..eda7b45324 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 fb3f9bffb1..5c7078df8e 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 #include #include +#include +#include + +#include +#include #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 );