bug-gnulib
[Top][All Lists]
Advanced

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

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


From: Pádraig Brady
Subject: Re: [PATCH] getlogin-tests: allow errno == ENOENT
Date: Fri, 09 Nov 2012 12:08:28 +0000
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:13.0) Gecko/20120615 Thunderbird/13.0.1

On 11/09/2012 09:05 AM, Paul Eggert wrote:
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 */


getlogin_r needs the same treatment probably.
I'll apply the attached in a while.

thanks,
Pádraig.

Attachment: getlogin_r.ENOENT.diff
Description: Text Data


reply via email to

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