90272a377cad05ff96933f10dbfd07a0a5535fd4 galt Tue Mar 1 21:16:10 2016 -0800 Oops, preserving errno better in messages diff --git src/lib/https.c src/lib/https.c index 754c05c..955cd2c 100644 --- src/lib/https.c +++ src/lib/https.c @@ -351,34 +351,35 @@ 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) { 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 ((saveErrno != 104) // udcCache often closes causing "Connection reset by peer" - && (saveErrno != 32)) // udcCache often closes causing "Broken pipe" + if ((errno != 104) // udcCache often closes causing "Connection reset by peer" + && (errno != 32)) // udcCache often closes causing "Broken pipe" xerrno("error writing https data back to user pipe"); goto cleanup; } bwt += bwtx; } brd = 0; bwt = 0; } } } cleanup: BIO_free_all(sbio); close(params->sv[1]); /* we are done with it */