tags:

views:

266

answers:

1

The code I am looking at is here:

http://github.com/andymatuschak/Sparkle/blob/8ea15468b4a8c0487ca7a72f3c9e6ffb708c6af8/SUPipedUnarchiver.m

Sparkle is like a plugin. It can be instantiated in a multi-threaded program. Thus I don't want to call signal(SIGPIPE, SIG_IGN) (ie. ignore all SIGPIPE) as who knows what other threads are doing/expecting.

How can I disable the SIGPIPE signal for this one FILE pointer opened via popen?

A: 

If the specs you are using to write your plugin don't specify what you have to do, I see nothing you can do with pipe(). A possible way to get out of this problem would be to write a popen() equivalent using socketpair() and fdopen().

AProgrammer
I don't understand the first sentence, but will look up socketpair. Thanks.
Max Howell
So you can't get sigpipe for a socketpair? I can't find that information.
Max Howell
With a socketpair you can use the send() call, and send() can (on BSDs atleast) take MSG_NOSIGNAL as a flag parameter which causes it to not deliver SIGPIPE.
nos