summaryrefslogtreecommitdiff
path: root/net-p2p/dctc/files/patch-src:dc_com.c
diff options
context:
space:
mode:
authorMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2001-11-22 04:32:47 +0000
committerMario Sergio Fujikawa Ferreira <lioux@FreeBSD.org>2001-11-22 04:32:47 +0000
commitbc737cecdd7ad5ff3befcdfd212cb0b75e053b39 (patch)
treefe6f1621519189af72f850d91026b25f938553e1 /net-p2p/dctc/files/patch-src:dc_com.c
parentAllow for slave ports to set different categories. (diff)
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 <debolaz@debolaz.com>
Diffstat (limited to 'net-p2p/dctc/files/patch-src:dc_com.c')
-rw-r--r--net-p2p/dctc/files/patch-src:dc_com.c52
1 files changed, 52 insertions, 0 deletions
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 <sys/param.h>
++#endif
++
++#if (defined(BSD) && (BSD >= 199103))
++#include <signal.h>
++#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) */