Message ID | 20230725193451.1327940-1-josimmon@redhat.com |
---|---|
State | New |
Headers | show |
Series | resolv/tst-resolv-res_init-skeleton: Check for filtered syscall | expand |
On 7/25/23 15:34, Joe Simmons-Talbott via Libc-alpha wrote: > If sethostname syscall is filtered return UNSUPPORTED. Under which environment does this happen? Documenting under which conditions this happens in the commit message is very valuable for later forensics when we're cleaning up code. > --- > resolv/tst-resolv-res_init-skeleton.c | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > 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"); Shouldn't this just be "sethostname syscall is filtered"? > + FAIL_EXIT1 ("sethostname: %m"); > + } > > /* These environment variables affect resolv.conf parsing. */ > unsetenv ("LOCALDOMAIN");
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");