Re: [PATCH BlueZ] core: Ignore SIGPIPE

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

 



I tried MSG_NOSIGNAL, see my other patch. the error is io_send: Socket
operation on non-socket.

please suggest an acceptable solution for this issue
On Fri, Nov 16, 2018 at 10:11 PM Gal Ben Haim <gbenhaim@xxxxxxxxxx> wrote:
>
> what should signal_handler do in case of SIGPIPE? will failed write
> return EPIPE if the signal is catched?
>
> On Fri, Nov 16, 2018 at 10:01 PM Marcel Holtmann <marcel@xxxxxxxxxxxx> wrote:
> >
> > Hi Gal,
> >
> > > 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.
> > >
> > > Ignoring the SIGPIPE will cause the write operation to return an
> > > error which will be logged as "io_send: Broken pipe".
> > > ---
> > > src/main.c | 10 +++++++---
> > > 1 file changed, 7 insertions(+), 3 deletions(-)
> > >
> > > diff --git a/src/main.c b/src/main.c
> > > index 4716f5388..c62886593 100644
> > > --- a/src/main.c
> > > +++ b/src/main.c
> > > @@ -691,7 +691,7 @@ int main(int argc, char *argv[])
> > >       uint16_t sdp_mtu = 0;
> > >       uint32_t sdp_flags = 0;
> > >       int gdbus_flags = 0;
> > > -     guint signal, watchdog;
> > > +     guint signal_source, watchdog;
> > >       const char *watchdog_usec;
> > >
> > >       init_defaults();
> > > @@ -721,7 +721,11 @@ int main(int argc, char *argv[])
> > >
> > >       event_loop = g_main_loop_new(NULL, FALSE);
> > >
> > > -     signal = setup_signalfd();
> > > +     signal_source = setup_signalfd();
> > > +
> > > +     /* Ignore SIGPIPE, a broken pipe error will be returned from write
> > > +      * attempts to a pipe with no readers */
> > > +     signal(SIGPIPE, SIG_IGN);
> >
> > if we decide not to use MSG_NOSIGNAL, then everything has to go via signalfd and not just by hacking in signal(SIG_IGN).
> >
> > Regards
> >
> > Marcel
> >



[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