summaryrefslogtreecommitdiff
path: root/modules
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2017-07-10 11:56:48 -0700
committerPaul Eggert <eggert@cs.ucla.edu>2017-07-10 12:02:09 -0700
commit24605b2f03bfa8367a9149835c687c9073aacc2c (patch)
tree55ef05fadaeaec93569187156a7db516a362717c /modules
parent8cb994d1fc4a957359780e1a4187b4f250c1cea5 (diff)
downloadgnulib-24605b2f03bfa8367a9149835c687c9073aacc2c.tar.gz
getlogin: don’t assume one name per uid
Problem reported by Wolfgang F. Muthmann (Bug#27640). * modules/getlogin-tests (Files): Add tests/test-getlogin_r.c. (ttyname): Remove test. * modules/getlogin_r-tests (ttyname): Remove test. * tests/test-getlogin.c: Replace this near-clone of test-getlogin_r.c with ‘#define TEST_LOGIN’ followed by ‘#include "test-getlogin_r.c"’. * tests/test-getlogin_r.c: If TEST_GETLOGIN is defined, test getlogin rather than getlogin_r. This avoids code duplication. (main): Use isatty and fstat rather than ttyname and stat. Use getpwnam instead of getpwuid, to be portable to test platforms that have multiple login names for the same uid.
Diffstat (limited to 'modules')
-rw-r--r--modules/getlogin-tests2
-rw-r--r--modules/getlogin_r-tests1
2 files changed, 1 insertions, 2 deletions
diff --git a/modules/getlogin-tests b/modules/getlogin-tests
index c8cdb05eb0..d7d6aeafa8 100644
--- a/modules/getlogin-tests
+++ b/modules/getlogin-tests
@@ -1,12 +1,12 @@
Files:
tests/test-getlogin.c
+tests/test-getlogin_r.c
tests/signature.h
tests/macros.h
Depends-on:
configure.ac:
-AC_CHECK_FUNCS_ONCE([ttyname])
Makefile.am:
TESTS += test-getlogin
diff --git a/modules/getlogin_r-tests b/modules/getlogin_r-tests
index 868b1b6f73..845658fdc2 100644
--- a/modules/getlogin_r-tests
+++ b/modules/getlogin_r-tests
@@ -6,7 +6,6 @@ tests/macros.h
Depends-on:
configure.ac:
-AC_CHECK_FUNCS_ONCE([ttyname])
Makefile.am:
TESTS += test-getlogin_r