/* ------------------------------------------------------------ */ /* Procedures common to all secure sessions */ /* ------------------------------------------------------------ */
int
PQsslInUse(PGconn *conn)
{ if (!conn) return0; return conn->ssl_in_use;
}
/* Set error message if appropriate */ switch (result_errno)
{ #ifdef EAGAIN case EAGAIN: #endif #ifdefined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) case EWOULDBLOCK: #endif case EINTR: /* no error message, caller is expected to retry */ break;
case EPIPE: case ECONNRESET:
libpq_append_conn_error(conn, "server closed the connection unexpectedly\n" "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request."); break;
case0: /* If errno didn't get set, treat it as regular EOF */
n = 0; break;
default:
libpq_append_conn_error(conn, "could not receive data from server: %s",
SOCK_STRERROR(result_errno,
sebuf, sizeof(sebuf))); break;
}
}
/* ensure we return the intended errno to caller */
SOCK_ERRNO_SET(result_errno);
/* Set error message if appropriate */ switch (result_errno)
{ #ifdef EAGAIN case EAGAIN: #endif #ifdefined(EWOULDBLOCK) && (!defined(EAGAIN) || (EWOULDBLOCK != EAGAIN)) case EWOULDBLOCK: #endif case EINTR: /* no error message, caller is expected to retry */ break;
case EPIPE: /* Set flag for EPIPE */
REMEMBER_EPIPE(spinfo, true);
/* FALL THRU */
case ECONNRESET:
conn->write_failed = true; /* Store error message in conn->write_err_msg, if possible */ /* (strdup failure is OK, we'll cope later) */
snprintf(msgbuf, sizeof(msgbuf),
libpq_gettext("server closed the connection unexpectedly\n" "\tThis probably means the server terminated abnormally\n" "\tbefore or while processing the request.")); /* keep newline out of translated string */
strlcat(msgbuf, "\n", sizeof(msgbuf));
conn->write_err_msg = strdup(msgbuf); /* Now claim the write succeeded */
n = len; break;
default:
conn->write_failed = true; /* Store error message in conn->write_err_msg, if possible */ /* (strdup failure is OK, we'll cope later) */
snprintf(msgbuf, sizeof(msgbuf),
libpq_gettext("could not send data to server: %s"),
SOCK_STRERROR(result_errno,
sebuf, sizeof(sebuf))); /* keep newline out of translated string */
strlcat(msgbuf, "\n", sizeof(msgbuf));
conn->write_err_msg = strdup(msgbuf); /* Now claim the write succeeded */
n = len; break;
}
}
RESTORE_SIGPIPE(conn, spinfo);
/* ensure we return the intended errno to caller */
SOCK_ERRNO_SET(result_errno);
return n;
}
/* Dummy versions of SSL info functions, when built without SSL support */ #ifndef USE_SSL
/* Block SIGPIPE and save previous mask for later reset */
SOCK_ERRNO_SET(pthread_sigmask(SIG_BLOCK, &sigpipe_sigset, osigset)); if (SOCK_ERRNO) return -1;
/* We can have a pending SIGPIPE only if it was blocked before */ if (sigismember(osigset, SIGPIPE))
{ /* Is there a pending SIGPIPE? */ if (sigpending(&sigset) != 0) return -1;
/* Clear SIGPIPE only if none was pending */ if (got_epipe && !sigpipe_pending)
{ if (sigpending(&sigset) == 0 &&
sigismember(&sigset, SIGPIPE))
{
sigset_t sigpipe_sigset;
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.16Bemerkung:
(Wie Sie bei der Firma Beratungs- und Dienstleistungen beauftragen können 2026-08-08)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.