From 907b103439ca5220e0161d29ff1d7ff0ebb8d315 Mon Sep 17 00:00:00 2001 From: Oxy Date: Mon, 7 Aug 2006 05:49:19 +0000 Subject: [PATCH] workaround for Linux-applications that do not catch SIGPIPE backported git-svn-id: https://pupnp.svn.sourceforge.net/svnroot/pupnp/branches/branch-1.4.x@76 119443c7-1b9e-41f8-b6fc-b9c35fce742c --- THANKS | 1 + upnp/src/genlib/net/http/httpparser.c | 10 +++++----- upnp/src/genlib/net/sock.c | 8 ++++++-- 3 files changed, 12 insertions(+), 7 deletions(-) diff --git a/THANKS b/THANKS index 269783f..da65952 100644 --- a/THANKS +++ b/THANKS @@ -6,6 +6,7 @@ suggesting various improvements or submitting actual code. Here is a list of these people. Help us keep it complete and exempt of errors. +- Erwan Velu - Paul Vixie - Arno Willig - Eric Tanguy diff --git a/upnp/src/genlib/net/http/httpparser.c b/upnp/src/genlib/net/http/httpparser.c index a13d51b..e5b47fd 100644 --- a/upnp/src/genlib/net/http/httpparser.c +++ b/upnp/src/genlib/net/http/httpparser.c @@ -868,11 +868,11 @@ match_int( INOUT scanner_t * scanner, OUT int *value ) { memptr token; - token_type_t tok_type; + token_type_t tok_type; parse_status_t status; - int num; - char *end_ptr; - size_t save_pos; + long num; + char *end_ptr; + size_t save_pos; save_pos = scanner->cursor; @@ -2391,7 +2391,7 @@ int raw_to_int( IN memptr * raw_value, IN int base ) { - int num; + long num; char *end_ptr; if( raw_value->length == 0 ) { diff --git a/upnp/src/genlib/net/sock.c b/upnp/src/genlib/net/sock.c index 9644587..c18e9eb 100644 --- a/upnp/src/genlib/net/sock.c +++ b/upnp/src/genlib/net/sock.c @@ -53,6 +53,10 @@ #endif #include "unixutil.h" +#ifndef MSG_NOSIGNAL + #define MSG_NOSIGNAL 0 +#endif + /************************************************************************ * Function : sock_init * @@ -229,7 +233,7 @@ sock_read_write( IN SOCKINFO * info, if( bRead ) { // read data - numBytes = recv( sockfd, buffer, bufsize,0); // MSG_NOSIGNAL is not a good idea in portable code, here SIGPIPE/SIGEPIPE has to be used instead + numBytes = recv( sockfd, buffer, bufsize,MSG_NOSIGNAL); } else { byte_left = bufsize; bytes_sent = 0; @@ -237,7 +241,7 @@ sock_read_write( IN SOCKINFO * info, // write data num_written = send( sockfd, buffer + bytes_sent, byte_left, - MSG_DONTROUTE); // | MSG_NOSIGNAL is not a good idea in portable code, here SIGPIPE/SIGEPIPE has to be used instead + MSG_DONTROUTE|MSG_NOSIGNAL); if( num_written == -1 ) { return num_written; }