X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-getlogin.c;h=197aed8275d9ff946690c6f87d8843bf62e377e0;hb=1276a2c5f24c0c932426aca9c899fa524d2443f2;hp=9b84acb4685df919c986ae825cf3ff640da04a1e;hpb=7a85bea5631913483046e8f47893e4d42dafb2c9;p=gnulib.git diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c index 9b84acb46..197aed827 100644 --- a/tests/test-getlogin.c +++ b/tests/test-getlogin.c @@ -1,5 +1,5 @@ /* Test of getting user name. - Copyright (C) 2010 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 @@ -39,8 +39,18 @@ 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); + ASSERT (errno == ENOTTY + || errno == EINVAL /* seen on Linux/SPARC */ + || errno == ENXIO + ); #if !defined __hpux /* On HP-UX 11.11 it fails anyway. */ ASSERT (! isatty (0)); #endif