]> Savannah Git Hosting - gnulib.git/commitdiff
getlogin_r-tests: check return value rather than errno
authorPádraig Brady <P@draigBrady.com>
Thu, 22 May 2014 16:49:33 +0000 (17:49 +0100)
committerPádraig Brady <P@draigBrady.com>
Thu, 22 May 2014 16:52:39 +0000 (17:52 +0100)
* tests/test-getlogin_r.c (main): As per POSIX we should be
verifying the return value from getlogin_r() rather than errno.

ChangeLog
tests/test-getlogin_r.c

index aa3435059d7011691a7e1306d689248891dd695e..fc8a08153f88607109691b51f675e159e316622c 100644 (file)
--- 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
index 5c7078df8ed84ce916c105d10818736edc3d8c2d..11ded88f98079efc947f8a490409f8700cd219cd 100644 (file)
@@ -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));