X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-getlogin_r.c;h=ed103c9fc700af310db8e2e3e2e661ddcbb71d68;hb=46f5f314f34a08c9305758482d7d2fdb0e999d09;hp=bbb58a3222158fba219771a17d4976347168692f;hpb=6fe87bef894e5b110b2c1d495dd2bb0c8efa07ad;p=gnulib.git diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c index bbb58a322..ed103c9fc 100644 --- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -1,5 +1,5 @@ /* Test of getting user name. - Copyright (C) 2010-2011 Free Software Foundation, Inc. + Copyright (C) 2010-2014 Free Software Foundation, Inc. This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -40,9 +40,17 @@ main (void) err = getlogin_r (buf, sizeof (buf)); if (err != 0) { + if (errno == ENOENT) + { + /* This can happen on GNU/Linux. */ + fprintf (stderr, "Skipping test: no entry in utmp file.\n"); + return 77; + } + /* getlogin_r() fails when stdin is not connected to a tty. */ ASSERT (err == ENOTTY || errno == EINVAL /* seen on Linux/SPARC */ + || errno == ENXIO ); #if !defined __hpux /* On HP-UX 11.11 it fails anyway. */ ASSERT (! isatty (0));