[v2] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall

Message ID 20230727143125.3920636-1-josimmon@redhat.com
State New
Headers
Series [v2] resolv/tst-resolv-res_init-skeleton: Check for filtered syscall |

Checks

Context Check Description
redhat-pt-bot/TryBot-apply_patch success Patch applied to master at the time it was sent
redhat-pt-bot/TryBot-32bit success Build for i686
linaro-tcwg-bot/tcwg_glibc_build--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-aarch64 success Testing passed
linaro-tcwg-bot/tcwg_glibc_build--master-arm success Testing passed
linaro-tcwg-bot/tcwg_glibc_check--master-arm success Testing passed

Commit Message

Joe Simmons-Talbott July 27, 2023, 2:31 p.m. UTC
  If sethostname syscall is filtered return UNSUPPORTED.

Found in a podman container on Fedora x86_64.
---
Changes to v1:
  * update commit message to indicate where the failure was detected.

 resolv/tst-resolv-res_init-skeleton.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
  

Patch

diff --git a/resolv/tst-resolv-res_init-skeleton.c b/resolv/tst-resolv-res_init-skeleton.c
index cbdf377b84..c9bdf9712f 100644
--- a/resolv/tst-resolv-res_init-skeleton.c
+++ b/resolv/tst-resolv-res_init-skeleton.c
@@ -1039,7 +1039,11 @@  do_test (void)
   /* We are in an UTS namespace, so we can set the host name without
      altering the state of the entire system.  */
   if (sethostname (test_hostname, strlen (test_hostname)) != 0)
-    FAIL_EXIT1 ("sethostname: %m");
+    {
+      if (errno == EPERM)
+        FAIL_UNSUPPORTED ("sethostname syscall argument is filtered");
+      FAIL_EXIT1 ("sethostname: %m");
+    }
 
   /* These environment variables affect resolv.conf parsing.  */
   unsetenv ("LOCALDOMAIN");