bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH] getlogin-tests: allow errno == ENOENT


From: Paul Eggert
Subject: [PATCH] getlogin-tests: allow errno == ENOENT
Date: Fri, 09 Nov 2012 01:05:40 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:16.0) Gecko/20121028 Thunderbird/16.0.2

I found this problem when running 'make check' with the latest
coreutils, and pushed the following patch.

---
 ChangeLog             | 7 +++++++
 tests/test-getlogin.c | 7 +++++++
 2 files changed, 14 insertions(+)

diff --git a/ChangeLog b/ChangeLog
index 7e0129e..cca6c07 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2012-11-09  Paul Eggert  <address@hidden>
+
+       getlogin-tests: allow errno == ENOENT
+       * tests/test-getlogin.c (main): Skip tests if getlogin fails
+       with errno == ENOENT.  This happened to me on Ubuntu 12.04.1 x86,
+       when running a test in an Emacs shell buffer.
+
 2012-11-08  Jim Meyering  <address@hidden>
 
        tests/nap.h: avoid warning about unused variable
diff --git a/tests/test-getlogin.c b/tests/test-getlogin.c
index 449ceaa..d86fec2 100644
--- a/tests/test-getlogin.c
+++ b/tests/test-getlogin.c
@@ -39,6 +39,13 @@ main (void)
   buf = getlogin ();
   if (buf == NULL)
     {
+      if (errno == ENOENT)
+        {
+          /* This can happen on GNU/Linux.  */
+          fprintf (stderr, "Skipping test: no entry in utmp file.\n");
+          return 77;
+        }
+
       /* getlogin() fails when stdin is not connected to a tty.  */
       ASSERT (errno == ENOTTY
               || errno == EINVAL /* seen on Linux/SPARC */
-- 
1.7.11.7




reply via email to

[Prev in Thread] Current Thread [Next in Thread]