Re: handling borken pipes



What's the best way to handle this? I'm tempted just to throw in an ignore
signal handle (signal(SIGPIPE, SIG_IGN) of the top of my head) and pay no
attention to broken pipes, but I don't know enough to be sure this is always
correct. For instance, I don't get why the signal is fatal by default, as it
seems relatively minor.

Ignoring SIGPIPE is ok.
SIGPIPE was originally sent to processes writing to a "real" pipe i.e.
2 cooperative processes that communicate through a named/unnamed pipe.
Terminating the process, when receiving the SIGPIPE, was the correct
behavior: reader dies unexpectedly, it is nice to have the writer to
terminate by default (it was later on added for the BSD socket API)
Anyway, since ignoring SIGPIPE results in errno set to it when write
fails that's probably what you want.

and santosh is right: comp.unix.programmer is better place for that
kind of question ;-)

-- paulo
.



Relevant Pages

  • Re: handling borken pipes
    ... attention to broken pipes, but I don't know enough to be sure this is ... SIGPIPE was originally sent to processes writing to a "real" pipe i.e. ... Terminating the process, when receiving the SIGPIPE, was the correct ... since ignoring SIGPIPE results in errno set to it when write ...
    (comp.programming)
  • Re: Unable to understand behavior of pipe
    ... the write end of the pipe, ... Then this means whatever is written on stdout goes to pipe? ... the one that attempts to invoke sort) reads ... Parent is terminating ...
    (comp.unix.programmer)
  • Re: Broken Pipe: Don Knotts
    ... Griffith show and The Incredible Mr. Limpet. ... I didn't know he was a pipe smoker! ... I've noticed that not all broken pipes were pipe smokers... ...
    (alt.smokers.pipes)
  • Re: Airport Security Pipe Question
    ... Attending as many pipe shows as I do I fly quite abit. ... New pipes and smokers for the trip are ALWAYS in carry-on. ... problems with security or broken pipes. ...
    (alt.smokers.pipes)
  • Re: Broken Pipe: Don Knotts
    ... Griffith show and The Incredible Mr. Limpet. ... I didn't know he was a pipe smoker! ... I've noticed that not all broken pipes were pipe smokers... ...
    (alt.smokers.pipes)