summaryrefslogtreecommitdiff
path: root/tests/test-getlogin_r.c
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2014-05-22 17:49:33 +0100
committerPádraig Brady <P@draigBrady.com>2014-05-22 17:52:39 +0100
commit98ca2c063cfe019b673fd0ce81448c919e9c989c (patch)
tree8eb23dbb892628dfad1c2a986e6d90480ed62bd5 /tests/test-getlogin_r.c
parent11167af9538fb8526d30784ae048d45d1abc83b2 (diff)
downloadgnulib-98ca2c063cfe019b673fd0ce81448c919e9c989c.tar.gz
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.
Diffstat (limited to 'tests/test-getlogin_r.c')
-rw-r--r--tests/test-getlogin_r.c8
1 files changed, 4 insertions, 4 deletions
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));