diff --git a/openscap-c99-2.patch b/openscap-c99-2.patch new file mode 100644 index 0000000..5f7548e --- /dev/null +++ b/openscap-c99-2.patch @@ -0,0 +1,25 @@ +Python bindings: Do not reuse $result for pointer conversion result + +The $result variable may be a pointer, but SWIG_ConvertPtr returns +an int. This change avoids a compilation failure with current +compilers due to a C type error. + +Submitted upstream: x + +diff --git a/swig/openscap.i b/swig/openscap.i +index 219e1aa3c9ddf28b..6f29fc23c808bcfc 100644 +--- a/swig/openscap.i ++++ b/swig/openscap.i +@@ -64,9 +64,9 @@ + } + + %typemap(in) void * { +- $result = SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown); +- if (!SWIG_IsOK($result)) { +- %argument_fail($result, "$type", $symname, $argnum); ++ int ptrres = SWIG_ConvertPtr($input,%as_voidptrptr(&$1), 0, $disown); ++ if (!SWIG_IsOK(ptrres)) { ++ %argument_fail(ptrres, "$type", $symname, $argnum); + } + } + diff --git a/openscap-c99.patch b/openscap-c99.patch new file mode 100644 index 0000000..faa73d4 --- /dev/null +++ b/openscap-c99.patch @@ -0,0 +1,41 @@ +Fix type of libxml2 error callback function + +Current libxml2 uses void(void *user, const xmlError *error), +previously void(void *user, xmlError *error) was used. Switch the +function definition to the current type and add a cast to avoid +incompatible-pointer-types errors with newer compilers building +against older libxml2. + +Submitted upstream: x + +diff --git a/src/source/validate.c b/src/source/validate.c +index da8c46dcb185c3fe..ffc54f55031746fc 100644 +--- a/src/source/validate.c ++++ b/src/source/validate.c +@@ -46,7 +46,7 @@ struct ctxt { + char *filename; + }; + +-static void oscap_xml_validity_handler(void *user, xmlErrorPtr error) ++static void oscap_xml_validity_handler(void *user, const xmlError *error) + { + struct ctxt * context = (struct ctxt *) user; + +@@ -111,7 +111,7 @@ static inline int oscap_validate_xml(struct oscap_source *source, const char *sc + goto cleanup; + } + +- xmlSchemaSetParserStructuredErrors(parser_ctxt, oscap_xml_validity_handler, &context); ++ xmlSchemaSetParserStructuredErrors(parser_ctxt, (xmlStructuredErrorFunc) oscap_xml_validity_handler, &context); + + schema = xmlSchemaParse(parser_ctxt); + if (schema == NULL) { +@@ -125,7 +125,7 @@ static inline int oscap_validate_xml(struct oscap_source *source, const char *sc + goto cleanup; + } + +- xmlSchemaSetValidStructuredErrors(ctxt, oscap_xml_validity_handler, &context); ++ xmlSchemaSetValidStructuredErrors(ctxt, (xmlStructuredErrorFunc) oscap_xml_validity_handler, &context); + + doc = oscap_source_get_xmlDoc(source); + if (!doc) diff --git a/openscap.spec b/openscap.spec index 7394c36..a82f59c 100644 --- a/openscap.spec +++ b/openscap.spec @@ -1,6 +1,6 @@ Name: openscap Version: 1.3.9 -Release: 3%{?dist} +Release: 4%{?dist} Epoch: 1 Summary: Set of open source libraries enabling integration of the SCAP line of standards License: LGPL-2.1-or-later @@ -21,6 +21,8 @@ Patch2: openscap-1.3.9-includes.patch # Fix test test_sysctl_probe_all.sh Patch3: openscap-1.3.10-fix_sysctl_probe_tests-PR-2050.patch +Patch4: openscap-c99.patch +Patch5: openscap-c99-2.patch BuildRequires: make BuildRequires: cmake >= 2.6 @@ -275,6 +277,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';' %{_mandir}/man8/oscap-podman.8* %changelog +* Wed Jan 03 2024 Florian Weimer - 1:1.3.9-4 +- Fix C compatibility issues + * Wed Dec 20 2023 Jan Černý - 1:1.3.9-3 - Fix test test_sysctl_probe_all.sh - Clean up the repository