Re: [PATCH BlueZ] core: Catch SIGPIPE

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



i don't think it works at all... bluetoothd is still exiting with SIGPIPE.
i'm a bit lost with fixing this, I tried few methods that were
suggested here and the only one that actually worked is to ignore the
signal.

please advise how do you want to proceed with this..

On Sat, Nov 17, 2018 at 10:41 PM Gal Ben Haim <gbenhaim@xxxxxxxxxx> wrote:
>
> actually it does not log the broken pipe message, is it because errno
> isn't set before the signal handler is done?
> what do you think?
> On Sat, Nov 17, 2018 at 8:00 AM Gal Ben-Haim <gbenhaim@xxxxxxxxxx> wrote:
> >
> > bluetoothd receives a SIGPIPE and terminates if writing to a pipe that
> > was acquired by AcquireNotify and there are no readers. it can be
> > reproduced by terminating the reader process without closing the reader
> > end of the pipe.
> >
> > Catching SIGPIPE will cause the write call to return an EPIPE error
> > which will be logged as "io_send: Broken pipe".
> > ---
> >  src/main.c | 3 +++
> >  1 file changed, 3 insertions(+)
> >
> > diff --git a/src/main.c b/src/main.c
> > index 4716f5388..54cdb8d3f 100644
> > --- a/src/main.c
> > +++ b/src/main.c
> > @@ -533,6 +533,8 @@ static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
> >         case SIGUSR2:
> >                 __btd_toggle_debug();
> >                 break;
> > +       case SIGPIPE:
> > +               break;
> >         }
> >
> >         return TRUE;
> > @@ -549,6 +551,7 @@ static guint setup_signalfd(void)
> >         sigaddset(&mask, SIGINT);
> >         sigaddset(&mask, SIGTERM);
> >         sigaddset(&mask, SIGUSR2);
> > +       sigaddset(&mask, SIGPIPE);
> >
> >         if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) {
> >                 perror("Failed to set signal mask");
> > --
> > 2.19.1
> >



[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux