diff options
author | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-09 19:38:17 +0200 |
---|---|---|
committer | Rainer Gerhards <rgerhards@adiscon.com> | 2009-04-09 19:38:17 +0200 |
commit | b9b96fbfc66809532f4ed24d667947fa63ce68f5 (patch) | |
tree | 9e590001deb95e461d0edf593de2f315b88964e6 | |
parent | 04272876d12488b2039b28683dc53e1c802d303d (diff) | |
download | rsyslog-b9b96fbfc66809532f4ed24d667947fa63ce68f5.tar.gz rsyslog-b9b96fbfc66809532f4ed24d667947fa63ce68f5.tar.xz rsyslog-b9b96fbfc66809532f4ed24d667947fa63ce68f5.zip |
removed MSG_NOSIGNAL & provided work-around
as this send() option is not supported on Solaris. We now
simply ignore SIGPIPE
-rw-r--r-- | tests/tcpflood.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/tests/tcpflood.c b/tests/tcpflood.c index 254e9fd6..fcb68998 100644 --- a/tests/tcpflood.c +++ b/tests/tcpflood.c @@ -170,7 +170,7 @@ int sendMessages(void) else socknum = rand() % numConnections; lenBuf = sprintf(buf, "<167>Mar 1 01:00:00 172.20.245.8 tag msgnum:%8.8d:\n", i); - lenSend = send(sockArray[socknum], buf, lenBuf, MSG_NOSIGNAL); + lenSend = send(sockArray[socknum], buf, lenBuf, 0); if(lenSend != lenBuf) { printf("\r%5.5d\n", i); fflush(stdout); @@ -250,8 +250,17 @@ tcpSend(char *buf, int lenBuf) int main(int argc, char *argv[]) { int ret = 0; + struct sigaction sigAct; static char buf[1024]; + /* on Solaris, we do not HAVE MSG_NOSIGNAL, so for this reason + * we block SIGPIPE (not an issue for this program) + */ + memset(&sigAct, 0, sizeof(sigAct)); + sigemptyset(&sigAct.sa_mask); + sigAct.sa_handler = SIG_IGN; + sigaction(SIGPIPE, &sigAct, NULL); + setvbuf(stdout, buf, _IONBF, 48); if(argc != 5) { |