On Cygwin 2.9, I see this test failure:

FAIL: test-sethostname2
=======================

error setting valid hostname.
FAIL test-sethostname2.exe (exit status: 1)

This patch fixes it. Now the test reports
  Skipping test: insufficient permissions.


2021-01-20  Bruno Haible  <br...@clisp.org>

        sethostname tests: Avoid test failure on Cygwin.
        * tests/test-sethostname2.c (main): Treat errno EACCESS like EPERM.

diff --git a/tests/test-sethostname2.c b/tests/test-sethostname2.c
index 8e5c12d..2af95f6 100644
--- a/tests/test-sethostname2.c
+++ b/tests/test-sethostname2.c
@@ -76,7 +76,9 @@ main (int argc, char *argv[] _GL_UNUSED)
                    "Skipping test: sethostname is not really implemented.\n");
           return 77;
         }
-      else if (rcs == -1 && errno == EPERM)
+      else if (rcs == -1
+               && (errno == EPERM
+                   || errno == EACCES)) /* Cygwin */
         {
           fprintf (stderr, "Skipping test: insufficient permissions.\n");
           return 77;


Reply via email to