Source: opendnssec
Version: 1:2.1.13-1.1
Severity: serious
Tags: patch
User: debian-...@lists.debian.org
Usertags: ftbfs-gcc-14

This package fails to build from source on current sid.

   ../../../enforcer/src/utils/kaspcheck.c:101:33: error: implicit declaration 
of function ‘exit’ [-Wimplicit-function-declaration]
     101 |                                 exit(0);
      |                                 ^~~~
   ../../../enforcer/src/utils/kaspcheck.c:35:1: note: include ‘<stdlib.h>’ or 
provide a declaration of ‘exit’

A full build log is at

  
https://perl.debian.net/rebuild-logs/sid/opendnssec_2.1.13-1.1/opendnssec_2.1.13-1.1.buildlog

I'm not sure why this wasn't filed with the other GCC-14 test rebuild
bugs, but it's pretty clearly similar fallout. Usertagging accordingly.

See https://gcc.gnu.org/gcc-14/porting_to.html for information on GCC 14,
including the change that made implicit function declarations hard errors.

Trivial patch attached. Hope it helps.
-- 
Niko Tyni   nt...@debian.org
From: Niko Tyni <nt...@debian.org>
Date: Mon, 5 Aug 2024 21:32:40 +0100
X-Dgit-Generated: 1:2.1.13-1.1 68182ddc5e1c9df86552eee16c5660db08fd380f
Subject: Include stdlib.h for free(), exit() et al.

This fixes build failures with GCC-14, which made
implicit function declarations hard errors.

---

diff --git a/enforcer/src/utils/kaspcheck.c b/enforcer/src/utils/kaspcheck.c
index 9bac3b7..2fefd3c 100644
--- a/enforcer/src/utils/kaspcheck.c
+++ b/enforcer/src/utils/kaspcheck.c
@@ -31,6 +31,10 @@
 
 #include "config.h"
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #include "kc_helper.h"
 
 #include <libxml/parser.h>
diff --git a/enforcer/src/utils/kc_helper.c b/enforcer/src/utils/kc_helper.c
index 72d181f..f4b9f46 100644
--- a/enforcer/src/utils/kc_helper.c
+++ b/enforcer/src/utils/kc_helper.c
@@ -44,6 +44,10 @@
 #include <libxml/xpathInternals.h>
 #include <libxml/relaxng.h>
 
+#ifdef HAVE_STDLIB_H
+#include <stdlib.h>
+#endif
+
 #define StrFree(ptr) {if(ptr != NULL) {free(ptr); (ptr) = NULL;}}
 
 int kc_helper_printto_stdout = 0;

Reply via email to