This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2] sunrpc: Properly clean up if tst-udp-timeout fails
- From: Andreas Schwab <schwab at suse dot de>
- To: Matheus Castanho <msc at linux dot ibm dot com>
- Cc: fw at deneb dot enyo dot de, libc-alpha at sourceware dot org
- Date: Wed, 12 Feb 2020 15:27:03 +0100
- Subject: Re: [PATCH v2] sunrpc: Properly clean up if tst-udp-timeout fails
- References: <87d0akndxm.fsf@mid.deneb.enyo.de> <20200212141102.30848-1-msc@linux.ibm.com>
On Feb 12 2020, Matheus Castanho wrote:
> @@ -177,6 +180,14 @@ server_dispatch (struct svc_req *request, SVCXPRT *transport)
> }
> }
>
> +/* Function to be called before exit to make sure the
> + server process is properly killed. */
> +static void
> +kill_server (void)
> +{
> + kill(server_pid, SIGTERM);
Style: space before paren.
> @@ -381,16 +392,17 @@ do_test (void)
> TEST_VERIFY_EXIT (transport != NULL);
> TEST_VERIFY (svc_register (transport, PROGNUM, VERSNUM, server_dispatch, 0));
>
> - pid_t pid = xfork ();
> - if (pid == 0)
> + server_pid = xfork ();
> + if (server_pid == 0)
> {
> svc_run ();
> FAIL_EXIT1 ("supposed to be unreachable");
> }
> + atexit(kill_server);
Likewise.
Andreas.
--
Andreas Schwab, SUSE Labs, schwab@suse.de
GPG Key fingerprint = 0196 BAD8 1CE9 1970 F4BE 1748 E4D4 88E3 0EEA B9D7
"And now for something completely different."