X-Git-Url: http://erislabs.net/gitweb/?a=blobdiff_plain;f=tests%2Ftest-getlogin_r.c;h=68c681232b874d179ff472d2f8dd41fb4ea277b5;hb=880d107;hp=f566e038c8b6c8b6170f20073c2478a092fbda5d;hpb=d6b7bf83fda294dd77ce90aac0bcd73a7626894d;p=gnulib.git diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c index f566e038c..68c681232 100644 --- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -24,6 +24,7 @@ SIGNATURE_CHECK (getlogin_r, int, (char *, size_t)); #include +#include #include #include @@ -35,7 +36,13 @@ main (void) /* Test with a large enough buffer. */ char buf[1024]; - ASSERT (getlogin_r (buf, sizeof (buf)) == 0); + if (getlogin_r (buf, sizeof (buf)) != 0) + { + /* getlogin_r() 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__)