From f0c406c2cad3d701e8b331a6a82074bd01b3256a Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Thu, 20 Dec 2018 03:11:34 +0100
Subject: [PATCH] lchown tests: Be more permissive regarding errno values.

Reported by Ivan Zakharyaschev <imz@altlinux.org>.

* tests/test-lchown.h (test_lchown): Recognize EOPNOTSUPP as an
alternative to ENOSYS.
* modules/lchown-tests (Depends-on): Add 'errno'.
* modules/fchownat-tests (Depends-on): Likewise.
---
 ChangeLog              | 9 +++++++++
 modules/fchownat-tests | 1 +
 modules/lchown-tests   | 1 +
 tests/test-lchown.h    | 2 +-
 4 files changed, 12 insertions(+), 1 deletion(-)

diff --git a/ChangeLog b/ChangeLog
index f55c615b0e..fd28f3b2c5 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2018-12-19  Bruno Haible  <bruno@clisp.org>
+
+	lchown tests: Be more permissive regarding errno values.
+	Reported by Ivan Zakharyaschev <imz@altlinux.org>.
+	* tests/test-lchown.h (test_lchown): Recognize EOPNOTSUPP as an
+	alternative to ENOSYS.
+	* modules/lchown-tests (Depends-on): Add 'errno'.
+	* modules/fchownat-tests (Depends-on): Likewise.
+
 2018-12-18  Bruno Haible  <bruno@clisp.org>
 
 	duplocale: Avoid test failure on AIX 7.
diff --git a/modules/fchownat-tests b/modules/fchownat-tests
index 81adf7fe83..e5fb7833f4 100644
--- a/modules/fchownat-tests
+++ b/modules/fchownat-tests
@@ -7,6 +7,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+errno
 ignore-value
 intprops
 mgetgroups
diff --git a/modules/lchown-tests b/modules/lchown-tests
index c5bba89d50..42b946014c 100644
--- a/modules/lchown-tests
+++ b/modules/lchown-tests
@@ -6,6 +6,7 @@ tests/signature.h
 tests/macros.h
 
 Depends-on:
+errno
 ignore-value
 intprops
 mgetgroups
diff --git a/tests/test-lchown.h b/tests/test-lchown.h
index bc10a50381..8bf79b1bf2 100644
--- a/tests/test-lchown.h
+++ b/tests/test-lchown.h
@@ -124,7 +124,7 @@ test_lchown (int (*func) (char const *, uid_t, gid_t), bool print)
       return 77;
     }
   result = func (BASE "dir/link2", -1, -1);
-  if (result == -1 && errno == ENOSYS)
+  if (result == -1 && (errno == ENOSYS || errno == EOPNOTSUPP))
     {
       ASSERT (unlink (BASE "dir/file") == 0);
       ASSERT (unlink (BASE "dir/link2") == 0);
-- 
2.39.5