On 6/6/23 13:22, Richard W.M. Jones wrote: > If the client (curl plugin) disconnects early then the whole test can > fail with SIGPIPE, and it can be unclear why the test failed -- you > just get the mysterious error "FAIL test (exit status: 141)". We > always check the return code from write(2) so just report EPIPE > failures through that. > > In addition, a future extension to this test will allow writes to fail > with EPIPE in some circumstances. > --- > tests/web-server.c | 10 ++++++++++ > 1 file changed, 10 insertions(+) > > diff --git a/tests/web-server.c b/tests/web-server.c > index 9b37326c0..dbc8bc845 100644 > --- a/tests/web-server.c > +++ b/tests/web-server.c > @@ -43,6 +43,7 @@ > #include <fcntl.h> > #include <unistd.h> > #include <errno.h> > +#include <signal.h> > #include <sys/types.h> > #include <sys/stat.h> > #include <sys/socket.h> > @@ -90,6 +91,13 @@ cleanup (void) > rmdir (tmpdir); > } > > +static void > +ignore_sigpipe (void) > +{ > + struct sigaction sa = { .sa_flags = SA_RESTART, .sa_handler = SIG_IGN };
SA_RESTART makes no difference when the disposition is SIG_IGN; I'd rather remove SA_RESTART lest we imply otherwise. With that: Reviewed-by: Laszlo Ersek <ler...@redhat.com> > + sigaction (SIGPIPE, &sa, NULL); > +} > + > const char * > web_server (const char *filename, check_request_t _check_request) > { > @@ -97,6 +105,8 @@ web_server (const char *filename, check_request_t > _check_request) > pthread_t thread; > int err; > > + ignore_sigpipe (); > + > check_request = _check_request; > > /* Open the file. */ _______________________________________________ Libguestfs mailing list Libguestfs@redhat.com https://listman.redhat.com/mailman/listinfo/libguestfs