summaryrefslogtreecommitdiffstats
path: root/server/rfc1413.c
diff options
context:
space:
mode:
authorRyan Bloom <rbb@apache.org>1999-10-20 14:50:12 +0200
committerRyan Bloom <rbb@apache.org>1999-10-20 14:50:12 +0200
commit482dcf3495f36d69d8f4df9693a251050c5170fc (patch)
tree991db0c7c18464c5da52cf7e08304a9aec5ec87f /server/rfc1413.c
parentUse APR's getopt. (diff)
downloadapache2-482dcf3495f36d69d8f4df9693a251050c5170fc.tar.xz
apache2-482dcf3495f36d69d8f4df9693a251050c5170fc.zip
Add a status value to ap_log_error and ap_log_rerror. This allows us to use
apr_status codes in our error logs. The main advantage of this, is portable error codes. Now, Windows will finally be able to use errno! git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@84007 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'server/rfc1413.c')
-rw-r--r--server/rfc1413.c32
1 files changed, 17 insertions, 15 deletions
diff --git a/server/rfc1413.c b/server/rfc1413.c
index ac7092167d..3a9197b505 100644
--- a/server/rfc1413.c
+++ b/server/rfc1413.c
@@ -109,6 +109,7 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
{
unsigned int rmt_port, our_port;
unsigned int sav_rmt_port, sav_our_port;
+ ap_status_t status;
int i;
char *cp;
char buffer[RFC1413_MAXDATA + 1];
@@ -126,8 +127,8 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
ap_setport(sock, ANY_PORT);
ap_setipaddr(sock, local_ip);
- if (ap_bind(sock) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ if ((status = ap_bind(sock)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"bind: rfc1413: Error binding to local port");
return -1;
}
@@ -155,12 +156,12 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
i = 0;
while(i < strlen(buffer)) {
int j = strlen(buffer + i);
- ap_status_t stat;
- stat = ap_send(sock, buffer+i, &j);
- if (stat != APR_SUCCESS && stat != APR_EINTR) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
- "write: rfc1413: error sending request");
- return -1;
+ ap_status_t status;
+ status = ap_send(sock, buffer+i, &j);
+ if (status != APR_SUCCESS && status != APR_EINTR) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
+ "write: rfc1413: error sending request");
+ return -1;
}
else if (j > 0) {
i+=j;
@@ -181,12 +182,12 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
*/
while((cp = strchr(buffer, '\012')) == NULL && i < sizeof(buffer) - 1) {
int j = sizeof(buffer) - 1 - i;
- ap_status_t stat;
- stat = ap_recv(sock, buffer+i, &j);
- if (stat != APR_SUCCESS && stat != APR_EINTR) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ ap_status_t status;
+ status = ap_recv(sock, buffer+i, &j);
+ if (status != APR_SUCCESS && status != APR_EINTR) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"read: rfc1413: error reading response");
- return -1;
+ return -1;
}
else if (j > 0) {
i+=j;
@@ -216,14 +217,15 @@ static int get_rfc1413(ap_socket_t *sock, const char *local_ip,
/* rfc1413 - return remote user name, given socket structures */
char *ap_rfc1413(conn_rec *conn, server_rec *srv)
{
+ ap_status_t status;
static char user[RFC1413_USERLEN + 1]; /* XXX */
static char *result;
static ap_socket_t *sock;
result = FROM_UNKNOWN;
- if (ap_create_tcp_socket(&sock, conn->pool) != APR_SUCCESS) {
- ap_log_error(APLOG_MARK, APLOG_CRIT, srv,
+ if ((status = ap_create_tcp_socket(&sock, conn->pool)) != APR_SUCCESS) {
+ ap_log_error(APLOG_MARK, APLOG_CRIT, status, srv,
"socket: rfc1413: error creating socket");
conn->remote_logname = result;
}