873ffe864441ef8d03629f751137f3f8114e8cbe galt Fri May 20 23:54:36 2016 -0700 Fixes #17362. sigtimedwait not available on OSX. now uses sigwait. diff --git src/lib/https.c src/lib/https.c index 955cd2c..9c613c9 100644 --- src/lib/https.c +++ src/lib/https.c @@ -338,33 +338,34 @@ { // NOTE: Intended as a thread-specific library-safe way not to ignore SIG_PIPE for the entire application. // temporarily block sigpipe on this thread sigset_t sigpipe_mask; sigemptyset(&sigpipe_mask); sigaddset(&sigpipe_mask, SIGPIPE); sigset_t saved_mask; if (pthread_sigmask(SIG_BLOCK, &sigpipe_mask, &saved_mask) == -1) { perror("pthread_sigmask"); exit(1); } int bwtx = write(params->sv[1], bbuf+bwt, brd-bwt); int saveErrno = errno; if ((bwtx == -1) && (saveErrno == EPIPE)) { // if there was a EPIPE, accept and consume the SIGPIPE now. - struct timespec zerotime = {0}; - if (sigtimedwait(&sigpipe_mask, 0, &zerotime) == -1) + int sigErr, sig; + if ((sigErr = sigwait(&sigpipe_mask, &sig)) != 0) { + errno = sigErr; perror("sigtimedwait"); exit(1); } } // restore signal mask on this thread if (pthread_sigmask(SIG_SETMASK, &saved_mask, 0) == -1) { perror("pthread_sigmask"); exit(1); } errno = saveErrno; if (bwtx == -1) { if ((errno != 104) // udcCache often closes causing "Connection reset by peer" && (errno != 32)) // udcCache often closes causing "Broken pipe"