Skip to content

Commit

Permalink
mail-filter/opendkim: fix two musl/standards issues.
Browse files Browse the repository at this point in the history
New patches to fix a missing include and to correct a few function
signatures that violated the C standards.

Closes: https://bugs.gentoo.org/870412
Signed-off-by: Michael Orlitzky <[email protected]>
  • Loading branch information
orlitzky committed Feb 23, 2023
1 parent 00bd0cc commit 9c1172d
Show file tree
Hide file tree
Showing 3 changed files with 184 additions and 0 deletions.
155 changes: 155 additions & 0 deletions mail-filter/opendkim/files/opendkim-2.10.3-c-std.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,155 @@
From 2d6db0225da9632ddf25aa70839d9d6244af6a42 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <[email protected]>
Date: Thu, 23 Feb 2023 17:37:33 -0500
Subject: [PATCH 1/1] configure.ac: update main() signatures to conform to the
standard.

There are some tests in configure.ac that contain,

int main() { ... }

That's not the correct signature for main() according to the C
standard, and newer compilers are going to reject it. More information
about this can be found at,

https://wiki.gentoo.org/wiki/Modern_C_porting

In this case, the fix is simply to write

int main(int argc, char** argv) { ... }

instead.
---
configure.ac | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 1eaa95d8..d8162303 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,7 +147,7 @@ dnscheck='
#include <netinet/in.h>
#include <arpa/nameser.h>
#include <resolv.h>
-int main() {
+int main(int argc, char** argv) {
res_mkquery (0, 0, 0, 0, 0, 0, 0, 0, 0);
dn_expand (0, 0, 0, 0, 0);
dn_skipname (0, 0);
@@ -549,7 +549,7 @@ gprof_gmon_out="unknown"
if test x"$hasgprof" = x"yes"
then
gprofcheck='
-int main() {
+int main(int argc, char** argv) {
long x;

x = random();
@@ -747,7 +747,7 @@ then
#if GNUTLS_VERSION_NUMBER < 0x020b07
# error GnuTLS 2.11.7 or later required
#endif
- int main()
+ int main(int argc, char** argv)
{
return 0;
}'
@@ -759,7 +759,7 @@ then

sha256check='
#include <gnutls/gnutls.h>
- int main()
+ int main(int argc, char** argv)
{
int x = GNUTLS_DIG_SHA256;
}'
@@ -1191,7 +1191,7 @@ then
#include <libmemcached/memcached.h>

int
-main()
+main(int argc, char** argv)
{
memcached_return_t x;

@@ -1649,7 +1649,7 @@ then
#endif

int
-main()
+main(int argc, char** argv)
{
return 0;
}
@@ -1859,7 +1859,7 @@ then
#endif

int
-main()
+main(int argc, char** argv)
{
return 0;
}
--
2.39.2

From 1f551737e838723f9ad9be1692bb12a9a3b4cdd9 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <[email protected]>
Date: Thu, 23 Feb 2023 18:15:50 -0500
Subject: [PATCH 2/2] libvbr/vbr.c: modernize vbr_strlcpy() signature.

The vbr_strlcpy() function declares that its arguments should live in
registers:

vbr_strlcpy(dst, src, size)
register char *dst;
register const char *src;
ssize_t size;
{
...

This makes GCC unhappy when -Werror=strict-prototypes is used:

vbr.c:167:1: error: function declaration isn't a prototype
[-Werror=strict-prototypes]
167 | vbr_strlcpy(dst, src, size)

The "register" keyword is largely obsolete on modern systems anyway,
since the compiler is better at determining how to move memory around
than the programmer is. So to appease GCC and simplify the code a bit,
the signature has been changed to,

vbr_strlcpy(char *dst, const char *src, ssize_t size) { ... }

changes. Lines starting # with '#' will be ignored, and an empty
message aborts the commit. # # On branch configure.ac-c-standard #
Your branch is up to date with 'origin/configure.ac-c-standard'. # #
Changes to be committed: # modified: libvbr/vbr.c # # Changes not
staged for commit: # modified: configure # # Untracked files: #
0000-cover-letter.patch #
---
libvbr/vbr.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/libvbr/vbr.c b/libvbr/vbr.c
index cb9124d7..c6a2439f 100644
--- a/libvbr/vbr.c
+++ b/libvbr/vbr.c
@@ -164,12 +164,9 @@ static void vbr_error __P((VBR *, const char *, ...));
*/

size_t
-vbr_strlcpy(dst, src, size)
- register char *dst;
- register const char *src;
- ssize_t size;
+vbr_strlcpy(char *dst, const char *src, ssize_t size)
{
- register ssize_t i;
+ ssize_t i;

if (size-- <= 0)
return strlen(src);
--
2.39.2

27 changes: 27 additions & 0 deletions mail-filter/opendkim/files/opendkim-2.10.3-snprintf-include.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
From 706554992156dd655e893268f201bbecbe283eb5 Mon Sep 17 00:00:00 2001
From: Michael Orlitzky <[email protected]>
Date: Thu, 23 Feb 2023 17:05:36 -0500
Subject: [PATCH 1/1] libopendkim/util.c: include stdio.h for snprintf.

This fixes a build failure on musl, reported at

https://bugs.gentoo.org/896048
---
libopendkim/util.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/libopendkim/util.c b/libopendkim/util.c
index 6792b169..b1c6a769 100644
--- a/libopendkim/util.c
+++ b/libopendkim/util.c
@@ -17,6 +17,7 @@
# include <stdbool.h>
#endif /* HAVE_STDBOOL_H */
#include <ctype.h>
+#include <stdio.h>
#include <assert.h>
#include <string.h>
#include <errno.h>
--
2.39.2

2 changes: 2 additions & 0 deletions mail-filter/opendkim/opendkim-2.10.3-r30.ebuild
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ PATCHES=(
"${FILESDIR}/${P}-lua-pkgconfig-pt2.patch"
"${FILESDIR}/${P}-define-P-macro-in-libvbr.patch"
"${FILESDIR}/${P}-fix-libmilter-search.patch"
"${FILESDIR}/${P}-snprintf-include.patch"
"${FILESDIR}/${P}-c-std.patch"
)

pkg_setup() {
Expand Down

0 comments on commit 9c1172d

Please sign in to comment.