diff options
author | Paul Eggert <eggert@cs.ucla.edu> | 2012-11-09 01:03:33 -0800 |
---|---|---|
committer | Paul Eggert <eggert@cs.ucla.edu> | 2012-11-09 01:04:08 -0800 |
commit | 4f81aa5778dc88b99d21ad8d04a4bc9401366311 (patch) | |
tree | cd769e66e26c6bc47b7f2d50ff96a197df4e5fdf /tests | |
parent | 025f7741264a170d2a87c30370bc4b96b256f3b4 (diff) | |
download | gnulib-4f81aa5778dc88b99d21ad8d04a4bc9401366311.tar.gz |
getlogin-tests: allow errno == ENOENT
* tests/test-getlogin.c (main): Skip tests if getlogin fails
with errno == ENOENT. This happened to me on Ubuntu 12.04.1 x86,
when running a test in an Emacs shell buffer.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test-getlogin.c | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c index 449ceaa26c..d86fec2758 100644 --- a/tests/test-getlogin.c +++ b/tests/test-getlogin.c @@ -39,6 +39,13 @@ main (void) buf = getlogin (); if (buf == NULL) { + if (errno == ENOENT) + { + /* This can happen on GNU/Linux. */ + fprintf (stderr, "Skipping test: no entry in utmp file.\n"); + return 77; + } + /* getlogin() fails when stdin is not connected to a tty. */ ASSERT (errno == ENOTTY || errno == EINVAL /* seen on Linux/SPARC */ |