Mercurial > hg > octave-nkf > gnulib-hg
changeset 17679:4759a0035187
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.
author | Pádraig Brady <P@draigBrady.com> |
---|---|
date | Thu, 22 May 2014 17:49:33 +0100 |
parents | c25d6a669147 |
children | 0d94a18a81f9 |
files | ChangeLog tests/test-getlogin_r.c |
diffstat | 2 files changed, 10 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2014-05-22 Pádraig Brady <P@draigBrady.com> + + 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. + 2014-05-22 Pádraig Brady <P@draigBrady.com> getlogin_r-tests: fix various issues in recent change
--- a/tests/test-getlogin_r.c +++ b/tests/test-getlogin_r.c @@ -45,7 +45,7 @@ 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 @@ } /* 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));