summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStef Walter <stef@memberwebs.com>2005-03-24 06:21:57 +0000
committerStef Walter <stef@memberwebs.com>2005-03-24 06:21:57 +0000
commit99c15b68351b863073b0fa61e9a2b7ad4a80e01b (patch)
treeb8d17b47361eeb931b6e8f1318e3f44d0da9fc2f
parent81bf7672e13115299660a870d4253cdc2bd0f38c (diff)
Supress weird warnings when looking up names of local unix connections.
-rw-r--r--common/spio.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/common/spio.c b/common/spio.c
index a723936..c26f81a 100644
--- a/common/spio.c
+++ b/common/spio.c
@@ -117,6 +117,18 @@ void spio_attach(spctx_t* ctx, spio_t* io, int fd, struct sockaddr_any* peer)
io->fd = fd;
+ /* Get the address on which we accepted the connection */
+ memset(&locaddr, 0, sizeof(locaddr));
+ SANY_LEN(locaddr) = sizeof(locaddr);
+
+ if(getsockname(fd, &SANY_ADDR(locaddr), &SANY_LEN(locaddr)) == -1 ||
+ sock_any_ntop(&locaddr, io->localname, MAXPATHLEN, SANY_OPT_NOPORT) == -1)
+ {
+ if (errno != EAFNOSUPPORT)
+ sp_message(ctx, LOG_WARNING, "%s: couldn't get socket address", GET_IO_NAME(io));
+ strlcpy(io->localname, "UNKNOWN", MAXPATHLEN);
+ }
+
/* If the caller doesn't want the peer then use our own */
if (peer == NULL)
peer = &peeraddr;
@@ -127,21 +139,11 @@ void spio_attach(spctx_t* ctx, spio_t* io, int fd, struct sockaddr_any* peer)
if(getpeername(fd, &SANY_ADDR(*peer), &SANY_LEN(*peer)) == -1 ||
sock_any_ntop(peer, io->peername, MAXPATHLEN, SANY_OPT_NOPORT) == -1)
{
- sp_message(ctx, LOG_WARNING, "%s: couldn't get peer address", GET_IO_NAME(io));
+ if (errno != EAFNOSUPPORT)
+ sp_message(ctx, LOG_WARNING, "%s: couldn't get peer address", GET_IO_NAME(io));
strlcpy(io->peername, "UNKNOWN", MAXPATHLEN);
}
- /* Get the address on which we accepted the connection */
- memset(&locaddr, 0, sizeof(locaddr));
- SANY_LEN(locaddr) = sizeof(locaddr);
-
- if(getsockname(fd, &SANY_ADDR(locaddr), &SANY_LEN(locaddr)) == -1 ||
- sock_any_ntop(&locaddr, io->localname, MAXPATHLEN, SANY_OPT_NOPORT) == -1)
- {
- sp_message(ctx, LOG_WARNING, "%s: couldn't get socket address", GET_IO_NAME(io));
- strlcpy(io->localname, "UNKNOWN", MAXPATHLEN);
- }
-
/* As a double check */
io->line[0] = 0;
io->_nx = NULL;