[libvirt] [PATCH v5] util: Set SIGPIPE to a no-op handler invirFork

wang.yechao255 at zte.com.cn wang.yechao255 at zte.com.cn
Thu Nov 7 11:17:37 UTC 2019


> > @@ -783,7 +773,10 @@ virExec(virCommandPtr cmd)
> >      if (virCommandHandshakeChild(cmd) < 0)
> >         goto fork_error;
> >
> > -    if (sigaction(SIGPIPE, &waxon, NULL) < 0) {
> > +    memset(&sig_action, 0, sizeof(sig_action));
> > +    sig_action.sa_handler = SIG_DFL;
> > +    sigemptyset(&sig_action.sa_mask);
> > +    if (sigaction(SIGPIPE, &sig_action, NULL) < 0) {
> >          virReportSystemError(errno, "%s",
> >                               _("Could not re-enable SIGPIPE"));
> >          goto fork_error;
>
> We can just delete this sigaction() call entirely. The execve() call
> will purge the no-op handler function we registered in virFork(),
> resetting it back to SIG_DFL, so no need todo it manually here.

ok, i'll adjust the code and push another patch.
---
Best wishes
Wang Yechao


More information about the libvir-list mailing list