Fix -Wincompatible-pointer-types warning from gcc (issue #15)
Fix warning that gcc 14 will make into an error
Merge request reports
Activity
Looks like still some cleanups are necessary and this commit is not enough
make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/xdm-1.1.14/greeter' /bin/sh ../libtool --tag=CC --mode=compile /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I../include -fno-strict-aliasing -I/usr/include/freetype2 -DGREET_LIB -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c -o greet.lo greet.c libtool: compile: /usr/bin/gcc -DHAVE_CONFIG_H -I. -I.. -I../include -fno-strict-aliasing -I/usr/include/freetype2 -DGREET_LIB -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -Os -c greet.c -fPIC -DPIC -o .libs/greet.o greet.c: In function 'log_to_audit_system': greet.c:435:40: error: passing argument 3 of 'pam_get_item' from incompatible pointer type [-Wincompatible-pointer-types] 435 | pam_get_item(pamhp, PAM_RHOST, &hostname); | ^~~~~~~~~ | | | char ** In file included from /usr/include/security/pam_appl.h:18, from ../include/dm.h:105, from greet.c:73: /usr/include/security/_pam_types.h:175:68: note: expected 'const void **' but argument is of type 'char **' 175 | pam_get_item(const pam_handle_t *pamh, int item_type, const void **item); | ~~~~~~~~~~~~~^~~~ greet.c:436:38: error: passing argument 3 of 'pam_get_item' from incompatible pointer type [-Wincompatible-pointer-types] 436 | pam_get_item(pamhp, PAM_TTY, &tty); | ^~~~ | | | char ** /usr/include/security/_pam_types.h:175:68: note: expected 'const void **' but argument is of type 'char **' 175 | pam_get_item(const pam_handle_t *pamh, int item_type, const void **item); | ~~~~~~~~~~~~~^~~~ greet.c:437:39: error: passing argument 3 of 'pam_get_item' from incompatible pointer type [-Wincompatible-pointer-types] 437 | pam_get_item(pamhp, PAM_USER, &login); | ^~~~~~ | | | char ** /usr/include/security/_pam_types.h:175:68: note: expected 'const void **' but argument is of type 'char **' 175 | pam_get_item(const pam_handle_t *pamh, int item_type, const void **item); | ~~~~~~~~~~~~~^~~~ greet.c:440:9: warning: ignoring return value of 'audit_log_acct_message' declared with attribute 'warn_unused_result' [-Wunused-result] 440 | audit_log_acct_message(audit_fd, AUDIT_USER_LOGIN, | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 441 | NULL, "login", login ? login : "(unknown)", | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 442 | pw ? pw->pw_uid : -1, hostname, NULL, tty, success); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ make[2]: *** [Makefile:539: greet.lo] Error 1
!19 (merged) is my attempt to fix.
Strangely, I also don't see any warnings for
pam_get_item()
in our CI logs when building on Debian stable.Please try to build with
-Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3
. This define is used by devel glibc so testing this on top of Debian stable does not make to much sense.Edited by Tomasz Kłoczko
mentioned in issue #16 (closed)