From fd064d3b88e59ee71aec508687403539b01d643c Mon Sep 17 00:00:00 2001 From: Ruslan Ermilov Date: Mon, 23 May 2016 16:37:20 +0300 Subject: Introduced the ngx_sockaddr_t type. It's properly aligned and can hold any supported sockaddr. --- src/mail/ngx_mail.h | 12 +----------- src/mail/ngx_mail_core_module.c | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) (limited to 'src/mail') diff --git a/src/mail/ngx_mail.h b/src/mail/ngx_mail.h index cc5b15c2d..277f92060 100644 --- a/src/mail/ngx_mail.h +++ b/src/mail/ngx_mail.h @@ -27,17 +27,7 @@ typedef struct { typedef struct { - union { - struct sockaddr sockaddr; - struct sockaddr_in sockaddr_in; -#if (NGX_HAVE_INET6) - struct sockaddr_in6 sockaddr_in6; -#endif -#if (NGX_HAVE_UNIX_DOMAIN) - struct sockaddr_un sockaddr_un; -#endif - } u; - + ngx_sockaddr_t u; socklen_t socklen; /* server ctx */ diff --git a/src/mail/ngx_mail_core_module.c b/src/mail/ngx_mail_core_module.c index f3852bf36..89f835d5d 100644 --- a/src/mail/ngx_mail_core_module.c +++ b/src/mail/ngx_mail_core_module.c @@ -337,7 +337,7 @@ ngx_mail_core_listen(ngx_conf_t *cf, ngx_command_t *cmd, void *conf) ngx_memzero(ls, sizeof(ngx_mail_listen_t)); - ngx_memcpy(&ls->u.sockaddr, u.sockaddr, u.socklen); + ngx_memcpy(&ls->u.sockaddr, &u.sockaddr, u.socklen); ls->socklen = u.socklen; ls->backlog = NGX_LISTEN_BACKLOG; -- cgit