su.c: build failure with GCC 14 (-Wincompatible-pointer-types)
thesamesam opened this issue · 2 comments
thesamesam commented
GCC 14 will make -Wincompatible-pointer-types
as well as some other serious warnings errors by default. See https://wiki.gentoo.org/wiki/Modern_C_porting#What_changed.3F for the full list.
shadow master at 08ae7af fails to build with:
su.c:669:44: error: passing argument 3 of ‘pam_get_item’ from incompatible pointer type [-Wincompatible-pointer-types]
669 | ret = pam_get_item(pamh, PAM_USER, &tmp_name);
| ^~~~~~~~~
| |
| const char **
In file included from /usr/include/security/pam_appl.h:18,
from ../lib/pam_defs.h:9,
from su.c:56:
/usr/include/security/_pam_types.h:181:68: note: expected ‘const void **’ but argument is of type ‘const char **’
181 | pam_get_item(const pam_handle_t *pamh, int item_type, const void **item);
| ~~~~~~~~~~~~~^~~~
su.c: In function ‘main’:
su.c:1229:26: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers]
1229 | argv[-1] = cp;
| ^
make[2]: *** [Makefile:1213: su.o] Error 1
thesamesam commented
Introduced by ef95bb7 (@alejandro-colomar).
alejandro-colomar commented
Hmmm, I'll try to fix this without reintroducing the fprintf(3) warning and without resorting to casts. Thanks!