From bc737cecdd7ad5ff3befcdfd212cb0b75e053b39 Mon Sep 17 00:00:00 2001 From: Mario Sergio Fujikawa Ferreira Date: Thu, 22 Nov 2001 04:32:47 +0000 Subject: o New port dctc version 0.59: A DirectConnect (www.neo-modus.com) text client for file sharing o Renamed hublist to dc_hublist; former was too generic o FreeBSD's send(2) (in fact, all *BSD) does not support MSG_NOSIGMASK or any similar feature. Therefore, tried to mimick it with signal masking. However, this introduces a possible race condition which, fortunaly, is not triggered by this application since it is not concurrent. Reviewed by: Anders Nor Berle --- net-p2p/dctc/files/patch-src:dc_com.c | 52 +++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) create mode 100644 net-p2p/dctc/files/patch-src:dc_com.c (limited to 'net-p2p/dctc/files/patch-src:dc_com.c') diff --git a/net-p2p/dctc/files/patch-src:dc_com.c b/net-p2p/dctc/files/patch-src:dc_com.c new file mode 100644 index 000000000000..087695791f12 --- /dev/null +++ b/net-p2p/dctc/files/patch-src:dc_com.c @@ -0,0 +1,52 @@ +--- src/dc_com.c.orig Thu Nov 22 00:12:50 2001 ++++ src/dc_com.c Thu Nov 22 00:15:55 2001 +@@ -33,6 +33,15 @@ + #include "main.h" + #include "var.h" + ++#if (defined(__unix__) || defined(unix)) && !defined(USG) ++#include ++#endif ++ ++#if (defined(BSD) && (BSD >= 199103)) ++#include ++#define MSG_NOSIGNAL 0 ++#endif ++ + char last_cmd[5120]; /* contains the first string of the last send_dc_line call */ + /* mainly used for debug features. */ + time_t last_cmd_time; +@@ -50,6 +59,10 @@ + /***********************************************************/ + void send_dc_line(int sck,...) + { ++#if (defined(BSD) && (BSD >= 199103)) ++ sigset_t sigset, sigoset; ++ ssize_t send_return; ++#endif + va_list ap; + char *t; + int have=0; +@@ -84,7 +97,21 @@ + + if((str->len)&&(cnx_in_progress==0)) + { +- if(send(sck,str->str,str->len,MSG_NOSIGNAL)!=str->len) ++#if (defined(BSD) && (BSD >= 199103)) ++ /* possible race condition since backup and restore ++ are not guaranteed to occur as a single operation */ ++ ++ /* backup sigmask and block SIGPIPE */ ++ sigemptyset(&sigset); ++ sigaddset(&sigset,SIGPIPE); ++ (void) sigprocmask(SIG_BLOCK, &sigset, &sigoset); ++#endif ++ send_return = send(sck,str->str,str->len, MSG_NOSIGNAL); ++#if (defined(BSD) && (BSD >= 199103)) ++ /* restore sigmask backup */ ++ (void)sigprocmask(SIG_SETMASK, &sigoset, NULL); ++#endif ++ if(send_return!=str->len) + { + /* abort network operation on this socket */ + /* this will either generated a hub_disconnection message (main thread) */ -- cgit v1.2.3