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

Re: problem with GNU C



Ilya Teterin writes:

> The real reason of termination: program receives SIGPIPE on
> send(). Select() says that socket is writeable alredy. Removing
> fcntl will resolve problem.  Any ideas?

SIGPIPE is what you get when you write on a socket or pipe that isn't
connected [any more].  See the send(2) man page, for instance.  As to
why it's not connected in this case, that might depend on whatever
you're talking to, or on something else that your program does.
strace might be informative.

Your options are to block SIGPIPE, to set SIGPIPE to SIG_IGN, or to
use MSG_NOSIGNAL with send (but the latter is not portable).

(The reason you don't get an error message is that bash doesn't report
any error if commands terminate on SIGPIPE.  In this situation this is
a nuisance, in other situations it's the preferred behaviour.  The
whole SIGPIPE situation is a mess.)

ttfn/rjk



Reply to: