From 98ca2c063cfe019b673fd0ce81448c919e9c989c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A1draig=20Brady?= Date: Thu, 22 May 2014 17:49:33 +0100 Subject: getlogin_r-tests: check return value rather than errno * tests/test-getlogin_r.c (main): As per POSIX we should be verifying the return value from getlogin_r() rather than errno. --- tests/test-getlogin_r.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'tests/test-getlogin_r.c') diff --git a/tests/test-getlogin_r.c b/tests/test-getlogin_r.c index 5c7078df8e..11ded88f98 100644 --- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -45,7 +45,7 @@ main (void) err = getlogin_r (buf, sizeof (buf)); if (err != 0) { - if (errno == ENOENT) + if (err == ENOENT) { /* This can happen on GNU/Linux. */ fprintf (stderr, "Skipping test: no entry in utmp file.\n"); @@ -53,9 +53,9 @@ main (void) } /* getlogin_r() fails when stdin is not connected to a tty. */ - ASSERT (errno == ENOTTY - || errno == EINVAL /* seen on Linux/SPARC */ - || errno == ENXIO + ASSERT (err == ENOTTY + || err == EINVAL /* seen on Linux/SPARC */ + || err == ENXIO ); #if !defined __hpux /* On HP-UX 11.11 it fails anyway. */ ASSERT (! isatty (0)); -- cgit v1.2.1