[PATCH]Fix function pointer correctness to prepare for future gcc changes
Hanno Böck <[email protected]> Wed, 19 Mar 2025 13:57:07 +0100
| Newsgroups | gmane.mail.imap.courier.general |
|---|---|
| Message-ID | <[email protected]> |
Hello, Future gcc versions will be stricter about mismatching function pointers. See, e.g.: https://bugs.gentoo.org/944900 If you do not want to install future experimental gcc versions, this can already be tested with clang, which has an optional warning for it by setting CC="clang" and CFLAGS="-Wincompatible-function-pointer-types-strict -Werror=incompatible-function-pointer-types-strict" In starttls.c, courier sets the function child_handler() as the sa_handler for a sigaction struct. However, that expects an integer argument. The other two cases are mismatches where a function pointer expects a function with (void), while a () is given. After applying the patch, it compiles successfully with clang and the above warnings, and hopefully will also with gcc 15 (have not tested the latter). -- Hanno Böck https://hboeck.de/ _______________________________________________ courier-users mailing list [email protected] Unsubscribe: https://lists.sourceforge.net/lists/listinfo/courier-users
courier-fix-function-pointer-correctness.diff
(text/x-patch, 1.1 KB)
diff '--color=auto' -Naurp a/courier/module.esmtp/courieresmtpd.c b/courier/module.esmtp/courieresmtpd.c
--- a/courier/module.esmtp/courieresmtpd.c 2021-05-22 22:35:32.000000000 +0200
+++ b/courier/module.esmtp/courieresmtpd.c 2025-03-19 13:53:11.196003771 +0100
@@ -87,7 +87,7 @@ static const char *smtp_externalauth()
return NULL;
}
-static void tarpit()
+static void tarpit(void)
{
const char *p;
if ((p=getenv("TARPIT")) && atoi(p))
diff '--color=auto' -Naurp a/libs/tcpd/libcouriertls.c b/libs/tcpd/libcouriertls.c
--- a/libs/tcpd/libcouriertls.c 2023-11-17 02:51:19.000000000 +0100
+++ b/libs/tcpd/libcouriertls.c 2025-03-19 13:53:09.443989286 +0100
@@ -59,7 +59,7 @@
struct proto_ops {
char *n;
- const SSL_METHOD * (*m)();
+ const SSL_METHOD * (*m)(void);
int o;
};
diff '--color=auto' -Naurp a/libs/tcpd/starttls.c b/libs/tcpd/starttls.c
--- a/libs/tcpd/starttls.c 2023-11-17 02:51:19.000000000 +0100
+++ b/libs/tcpd/starttls.c 2025-03-19 13:53:07.403987816 +0100
@@ -522,7 +522,7 @@ static int connect_completed(ssl_handle
return (1);
}
-static void child_handler()
+static void child_handler(int signum)
{
alarm(10);
}