summaryrefslogtreecommitdiffstats
path: root/src/lmtp.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-31 17:17:13 +0400
committerVsevolod Stakhov <vsevolod@rambler-co.ru>2010-05-31 17:17:13 +0400
commit0612e84b3cec508c3d62d38c4e2682c85cc808bb (patch)
treedb777e38f9c528127e195ad01da6a3088dc6da4a /src/lmtp.c
parentae3eb4dfd787052bebc732c3e37b56f0800e1aa2 (diff)
downloadrspamd-0612e84b3cec508c3d62d38c4e2682c85cc808bb.tar.gz
rspamd-0612e84b3cec508c3d62d38c4e2682c85cc808bb.zip
* Fix strict aliasing while compiling with optimization
* Fix tanhl detection for platforms that have not implementation of it * Remove several compile warnings
Diffstat (limited to 'src/lmtp.c')
-rw-r--r--src/lmtp.c16
1 files changed, 7 insertions, 9 deletions
diff --git a/src/lmtp.c b/src/lmtp.c
index 9f7a4805a..385debfbb 100644
--- a/src/lmtp.c
+++ b/src/lmtp.c
@@ -224,14 +224,13 @@ static void
accept_socket (int fd, short what, void *arg)
{
struct rspamd_worker *worker = (struct rspamd_worker *)arg;
- struct sockaddr_storage ss;
- struct sockaddr_in *sin;
+ union sa_union su;
struct worker_task *new_task;
struct rspamd_lmtp_proto *lmtp;
- socklen_t addrlen = sizeof (ss);
+ socklen_t addrlen = sizeof (su.ss);
int nfd;
- if ((nfd = accept_from_socket (fd, (struct sockaddr *)&ss, &addrlen)) == -1) {
+ if ((nfd = accept_from_socket (fd, (struct sockaddr *)&su.ss, &addrlen)) == -1) {
msg_warn ("accept failed: %s", strerror (errno));
return;
}
@@ -240,14 +239,13 @@ accept_socket (int fd, short what, void *arg)
new_task = construct_task (worker);
- if (ss.ss_family == AF_UNIX) {
+ if (su.ss.ss_family == AF_UNIX) {
msg_info ("accepted connection from unix socket");
new_task->client_addr.s_addr = INADDR_NONE;
}
- else if (ss.ss_family == AF_INET) {
- sin = (struct sockaddr_in *)&ss;
- msg_info ("accepted connection from %s port %d", inet_ntoa (sin->sin_addr), ntohs (sin->sin_port));
- memcpy (&new_task->client_addr, &sin->sin_addr, sizeof (struct in_addr));
+ else if (su.ss.ss_family == AF_INET) {
+ msg_info ("accepted connection from %s port %d", inet_ntoa (su.s4.sin_addr), ntohs (su.s4.sin_port));
+ memcpy (&new_task->client_addr, &su.s4.sin_addr, sizeof (struct in_addr));
}
new_task->sock = nfd;