[libvirt] [PATCH v6] util: Set SIGPIPE to a no-op handler in virFork
Daniel P. Berrangé
berrange at redhat.com
Fri Nov 8 10:57:55 UTC 2019
On Fri, Nov 08, 2019 at 08:25:15AM +0800, Wang Yechao wrote:
> Libvirtd has set SIGPIPE to ignored, and virFork resets all signal
> handlers to the defaults. But child process may write logs to
> stderr/stdout, that may generate SIGPIPE if journald has stopped.
>
> So set SIGPIPE to a dummy no-op handler before unmask signals in
> virFork(), and the handler will get reset to SIG_DFL when execve()
> runs. Now we can delete sigaction() call entirely in virExec().
>
> Signed-off-by: Wang Yechao <wang.yechao255 at zte.com.cn>
>
> ---
> v3 patch:
> https://www.redhat.com/archives/libvir-list/2019-October/msg00934.html
>
> Changes in v4:
> - don't block SIGPIPE, ignore it when invoke VIR_FORCE_CLOSE and virCommandMassClose
>
> Changes in v5:
> - chang from SIG_IGN to a no-op handler in child process
>
> Changes in v6:
> - add a comment and delete sigaction() call entirely in virExec
> ---
> src/util/vircommand.c | 32 ++++++++++----------------------
> 1 file changed, 10 insertions(+), 22 deletions(-)
>
> diff --git a/src/util/vircommand.c b/src/util/vircommand.c
> index 93b3dd2..8b10253 100644
> --- a/src/util/vircommand.c
> +++ b/src/util/vircommand.c
> @@ -217,6 +217,8 @@ virCommandFDSet(virCommandPtr cmd,
>
> #ifndef WIN32
>
> +static void virDummyHandler(int sig G_GNUC_UNUSED) {}
'make syntax-check' didn't like {} on the same line like this.
I've fixed that trivial style issue and pushed to git.
Regards,
Daniel
--
|: https://berrange.com -o- https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org -o- https://fstop138.berrange.com :|
|: https://entangle-photo.org -o- https://www.instagram.com/dberrange :|
More information about the libvir-list
mailing list