From 9c38a557979e384e5fc0e3b85507242bee98321f Mon Sep 17 00:00:00 2001 From: des Date: Thu, 11 Dec 2003 13:55:16 +0000 Subject: Fix strict aliasing breakage in PAM modules (except pam_krb5, which needs more work than the others). This should make most modules build with -O2. --- lib/libpam/modules/pam_securetty/pam_securetty.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lib/libpam/modules/pam_securetty/pam_securetty.c') diff --git a/lib/libpam/modules/pam_securetty/pam_securetty.c b/lib/libpam/modules/pam_securetty/pam_securetty.c index 5dd7c90..edb6f3b 100644 --- a/lib/libpam/modules/pam_securetty/pam_securetty.c +++ b/lib/libpam/modules/pam_securetty/pam_securetty.c @@ -57,7 +57,8 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused, { struct passwd *pwd; struct ttyent *ty; - const char *user, *tty; + const char *user; + const void *tty; int pam_err; pam_err = pam_get_user(pamh, &user, NULL); @@ -72,7 +73,7 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused, if (pwd->pw_uid != 0) return (PAM_SUCCESS); - pam_err = pam_get_item(pamh, PAM_TTY, (const void **)&tty); + pam_err = pam_get_item(pamh, PAM_TTY, &tty); if (pam_err != PAM_SUCCESS) return (pam_err); @@ -81,7 +82,7 @@ pam_sm_acct_mgmt(pam_handle_t *pamh __unused, int flags __unused, /* Ignore any "/dev/" on the PAM_TTY item */ if (tty != NULL && strncmp(TTY_PREFIX, tty, sizeof(TTY_PREFIX)) == 0) { PAM_LOG("WARNING: PAM_TTY starts with " TTY_PREFIX); - tty += sizeof(TTY_PREFIX) - 1; + tty = (const char *)tty + sizeof(TTY_PREFIX) - 1; } if (tty != NULL && (ty = getttynam(tty)) != NULL && -- cgit v1.1