summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog1
-rw-r--r--common/spio.c26
2 files changed, 15 insertions, 12 deletions
diff --git a/ChangeLog b/ChangeLog
index 71b5e2b..afdafc9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,7 @@
- Don't leak file descriptors when clamsmtpd can't connect to outgoing
SMTP server [Chris Mason]
- Now accepts special format arguments on 'Header' line [Olivier Beyssac]
+ - Supress weird warnings when looking up names of local unix connections.
1.3 [2005-01-27]
- Fixed crasher when outgoing connection couldn't be established
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;