X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-getlogin.c;h=136510832a31fd7ffb8da37f69cb9e1241f20483;hb=2c35d5c11d2359c7ebb06a3388a544cbe2f9c7f5;hp=65892890da98c0373e9d82320d0be9fbc6a5c28c;hpb=39331312abd1f8eb8578ef30f7cb5d3ea8e0f4fd;p=gnulib.git diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c index 65892890d..136510832 100644 --- a/tests/test-getlogin.c +++ b/tests/test-getlogin.c @@ -23,6 +23,7 @@ #include "signature.h" SIGNATURE_CHECK (getlogin, char *, (void)); +#include #include #include @@ -35,7 +36,13 @@ main (void) /* Test value. */ buf = getlogin (); - ASSERT (buf != NULL); + if (buf == NULL) + { + /* getlogin() fails when stdin is not connected to a tty. */ + ASSERT (! isatty (0)); + fprintf (stderr, "Skipping test: stdin is not a tty.\n"); + return 77; + } /* Compare against the value from the environment. */ #if !((defined _WIN32 || defined __WIN32__) && !defined __CYGWIN__)