[sudo-workers] C99 fixes for the configure script

Todd C. Miller Todd.Miller at sudo.ws
Wed Apr 26 13:01:12 MDT 2023


On Wed, 26 Apr 2023 11:58:22 +0200, Florian Weimer via sudo-workers wrote:

> We are trying to build Fedora with more C misuse turned into errors:
>
>   <https://fedoraproject.org/wiki/Changes/PortingToModernC>
>   <https://fedoraproject.org/wiki/Toolchain/PortingToModernC>

Great.  I fixed a number of compiler warnings from the configure tests
several years ago but there are probably more lurking.  Are you running
configure with "CC=gcc -Werror=implicit-function-declaration" to
test this?

> The first issue is a bit tricky.  The lber.h probe also calso ldap_init,
> but it's deprecated in our <ldap.h> header and only declared if
> LDAP_DEPRECATED is defined.  So with a C99 compiler without implicit
> function declaration support, this probe checks for a declaration
> ldap_init, and not just for <ldap.h> usability without <lber.h>.

Thanks, I've committed a change to just call ldap_msgfree(NULL).

> The second issue is in the fortify probe.  It calls sprintf without
> including <stdio.h>, which also relies on implicit function
> declarations.

I committed the change to include stdio.h.  A long time ago I ran
into a platform where the gcc headers had some support for
_FORTIFY_SOURCE but the native libc did not.  It was not a Linux/glibc
platform.  Unfortunately, the details are lost to time but I think
it still makes sense to verify that a simple test program can build
with _FORTIFY_SOURCE=2.

 - todd


More information about the sudo-workers mailing list