pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/net/libfetch/files Use the hard-core approach of killi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/d97e0e650a13
branches:  trunk
changeset: 570059:d97e0e650a13
user:      joerg <joerg%pkgsrc.org@localhost>
date:      Sun Jan 24 16:54:23 2010 +0000

description:
Use the hard-core approach of killing SIGPIPE explicitly on
platforms that don't have MSG_NOSIGNAL like Solaris.

diffstat:

 net/libfetch/files/common.c |  21 ++++++++++++++++++++-
 1 files changed, 20 insertions(+), 1 deletions(-)

diffs (50 lines):

diff -r 817eeae1adcf -r d97e0e650a13 net/libfetch/files/common.c
--- a/net/libfetch/files/common.c       Sun Jan 24 15:03:12 2010 +0000
+++ b/net/libfetch/files/common.c       Sun Jan 24 16:54:23 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: common.c,v 1.24 2010/01/23 14:25:26 joerg Exp $        */
+/*     $NetBSD: common.c,v 1.25 2010/01/24 16:54:23 joerg Exp $        */
 /*-
  * Copyright (c) 1998-2004 Dag-Erling Coïdan Smørgrav
  * Copyright (c) 2008, 2010 Joerg Sonnenberger <joerg%NetBSD.org@localhost>
@@ -62,6 +62,10 @@
 #include <string.h>
 #include <unistd.h>
 
+#ifndef MSG_NOSIGNAL
+#include <signal.h>
+#endif
+
 #include "fetch.h"
 #include "common.h"
 
@@ -624,6 +628,17 @@
        fd_set writefds;
        ssize_t wlen, total;
        int r;
+#ifndef MSG_NOSIGNAL
+       static int killed_sigpipe;
+#endif
+
+#ifndef MSG_NOSIGNAL
+       if (!killed_sigpipe) {
+               signal(SIGPIPE, SIG_IGN);
+               killed_sigpipe = 1;
+       }
+#endif
+
 
        if (fetchTimeout) {
                FD_ZERO(&writefds);
@@ -661,7 +676,11 @@
                        wlen = SSL_write(conn->ssl, buf, len);
                else
 #endif
+#ifndef MSG_NOSIGNAL
+                       wlen = send(conn->sd, buf, len, 0);
+#else
                        wlen = send(conn->sd, buf, len, MSG_NOSIGNAL);
+#endif
                if (wlen == 0) {
                        /* we consider a short write a failure */
                        errno = EPIPE;



Home | Main Index | Thread Index | Old Index