is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Anton Yuzhaninov
Hello. Is SO_NOSIGPIPE work? It try to set on socket option SO_NOSIGPIPE but anyway process received sigpipe. Test case: #include sys/types.h #include sys/socket.h #include netinet/in.h #include signal.h #define SERVER_PORT 8000 void sigpipe(int signo __unused) { printf(SIGPIPE

Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Ruslan Ermilov
Hi Anton, On Thu, Mar 01, 2007 at 03:17:29PM +0300, Anton Yuzhaninov wrote: Hello. Is SO_NOSIGPIPE work? It try to set on socket option SO_NOSIGPIPE but anyway process received sigpipe. It works, but only if you use send() instead of write(). Alternatively, you can control the behavior

Re[2]: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Anton Yuzhaninov
Thursday, March 1, 2007, 6:29:42 PM, Ruslan Ermilov wrote: RE On Thu, Mar 01, 2007 at 03:17:29PM +0300, Anton Yuzhaninov wrote: Is SO_NOSIGPIPE work? It try to set on socket option SO_NOSIGPIPE but anyway process received sigpipe. RE It works, but only if you use send() instead of write().

Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Bruce M. Simpson
Anton Yuzhaninov wrote: RE It works, but only if you use send() instead of write(). RE Alternatively, you can control the behavior on a per RE message basis, by passing the MSG_NOSIGNAL in the flags RE argument to the send() call (without having to set a RE socket option). Thanks, with send()

[PATCH] Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Bruce M. Simpson
Anton Yuzhaninov wrote: Thanks, with send() it works fine. I think it should be documented in setsockopt(2). Try this patch. The comment doesn't reflect what the code does. SIGPIPE may actually be getting queued twice in your case. It is most likely that the process's main thread wasn't

Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Anton Yuzhaninov
Thursday, March 1, 2007, 8:34:50 PM, Bruce M. Simpson wrote: BMS Anton Yuzhaninov wrote: Thanks, with send() it works fine. I think it should be documented in setsockopt(2). BMS Try this patch. The comment doesn't reflect what the code does. SIGPIPE BMS may actually be getting queued twice in

Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Bruce M. Simpson
Anton Yuzhaninov wrote: Works for me. Committed, thanks for finding this bug. BMS ___ freebsd-net@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-net To unsubscribe, send any mail to [EMAIL PROTECTED]

Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread N.J. Mann
On Thursday, 1 March, 2007 at 17:34:50 +, Bruce M. Simpson wrote: Anton Yuzhaninov wrote: Thanks, with send() it works fine. I think it should be documented in setsockopt(2). Try this patch. The comment doesn't reflect what the code does. SIGPIPE may actually be getting queued twice

Re: [PATCH] Re: is setsockopt SO_NOSIGPIPE work?

2007-03-01 Thread Bruce M. Simpson
N.J. Mann wrote: Could this be why mail from cron doesn't work for me in 6.2? I got as far as finding that cron receives a SIGPIPE while sending the mail message to sendmail, but never worked out why. I ended up hacking cron to ignore SIGPIPE and then ENOTIME to investigate further.