Fix PAM const-qualifier detection for Hammerhead/illumos. xdm keys the `XDM_PAM_QUAL` const qualifier (used on the pam_conv callback and pam_get_item() arguments) on `#ifdef __sun`, assuming any __sun target uses the classic Solaris non-const PAM prototypes. Hammerhead's GCC defines __sun, but its defaults to the CONST-qualified form (int (*conv)(int, const struct pam_message **, ...) and pam_get_item(..., const void **)) unless _PAM_LEGACY_NONCONST is defined. With __sun alone, XDM_PAM_QUAL expands empty (non-const) and greet.c fails to compile under GCC 14 with -Wincompatible-pointer-types (now a hard error): greet.c:496: initialization of 'int (*)(int, const struct pam_message **,...)' from incompatible pointer type 'int (*)(int, struct pam_message **,...)' greet.c:588/613/735: passing argument 3 of 'pam_get_item' from incompatible pointer type Gate the non-const branch on _PAM_LEGACY_NONCONST as well, so the qualifier matches whichever prototype form the PAM headers actually present. On Hammerhead this selects `const`, matching the default headers; on a legacy Solaris that defines _PAM_LEGACY_NONCONST it stays empty as before. --- a/greeter/greet.c +++ b/greeter/greet.c @@ -152,9 +152,13 @@ static XtIntervalId pingTimeout; #ifdef USE_PAM -#ifdef __sun -/* Solaris does not const qualify arguments to pam_get_item() or the - PAM conversation function that Linux-PAM and others do. */ +#if defined(__sun) && defined(_PAM_LEGACY_NONCONST) +/* Classic Solaris did not const qualify arguments to pam_get_item() or the + PAM conversation function that Linux-PAM and others do. Hammerhead's + defaults to the const-qualified (non-legacy) form + unless _PAM_LEGACY_NONCONST is defined, and Hammerhead's GCC also defines + __sun, so key the qualifier on _PAM_LEGACY_NONCONST rather than on __sun + alone. */ # define XDM_PAM_QUAL /**/ #else # define XDM_PAM_QUAL const