summaryrefslogtreecommitdiff
path: root/common
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
commite753e3d5a596e081eeef637ad0f5f4e3ebd90a15 (patch)
tree25f572a71f32eb3aff394b4a2090163ee57020c6 /common
parent574e3512c03ad21f2c4c514ebb0c12767171ad57 (diff)
Supress weird warnings when looking up names of local unix connections.
Diffstat (limited to 'common')
-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;