From 466e1de674b42b2afe13d2edd998acbf656a9c76 Mon Sep 17 00:00:00 2001 From: "Dmitry V. Levin" Date: Thu, 19 Mar 2020 18:40:16 +0000 Subject: Fix remaining clang -Wcast-align compilation warnings Introduce DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN macros, use them to silence remaining clang -Wcast-align compilation warnings. * libpam/include/pam_cc_compat.h (DIAG_PUSH_IGNORE_CAST_ALIGN, DIAG_POP_IGNORE_CAST_ALIGN): New macros. * modules/pam_access/pam_access.c: Include "pam_cc_compat.h". (from_match, network_netmask_match): Wrap inet_ntop invocations in DIAG_PUSH_IGNORE_CAST_ALIGN and DIAG_POP_IGNORE_CAST_ALIGN. --- modules/pam_access/pam_access.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'modules/pam_access') diff --git a/modules/pam_access/pam_access.c b/modules/pam_access/pam_access.c index 9a427ee2..9eab923a 100644 --- a/modules/pam_access/pam_access.c +++ b/modules/pam_access/pam_access.c @@ -66,6 +66,8 @@ #include #include +#include "pam_cc_compat.h" + /* login_access.c from logdaemon-5.6 with several changes by A.Nogin: */ /* @@ -650,9 +652,11 @@ from_match (pam_handle_t *pamh UNUSED, char *tok, struct login_info *item) if (runp->ai_family == AF_INET) { + DIAG_PUSH_IGNORE_CAST_ALIGN; inet_ntop (runp->ai_family, &((struct sockaddr_in *) runp->ai_addr)->sin_addr, buf, sizeof (buf)); + DIAG_POP_IGNORE_CAST_ALIGN; strcat (buf, "."); @@ -781,11 +785,13 @@ network_netmask_match (pam_handle_t *pamh, { char buf[INET6_ADDRSTRLEN]; + DIAG_PUSH_IGNORE_CAST_ALIGN; inet_ntop (runp->ai_family, runp->ai_family == AF_INET ? (void *) &((struct sockaddr_in *) runp->ai_addr)->sin_addr : (void *) &((struct sockaddr_in6 *) runp->ai_addr)->sin6_addr, buf, sizeof (buf)); + DIAG_POP_IGNORE_CAST_ALIGN; if (are_addresses_equal(buf, tok, netmask_ptr)) { -- cgit v1.2.3