guix_mirror_bot pushed a commit to branch master
in repository guix.

commit b94aae49b75478ec6eab937161fb994386099042
Author: David Elsing <[email protected]>
AuthorDate: Tue Jul 29 16:19:32 2025 +0200

    gnu: sajson: Fix build.
    
    Prevent the example from calling fclose multiple times.
    
    * gnu/packages/cpp.scm (sajson)[arguments]: Add 'fix-example phase.
    
    Change-Id: Icec4ef43fe5835810411a5a5681d552c5744aae6
    Signed-off-by: Sharlatan Hellseher <[email protected]>
---
 gnu/packages/cpp.scm | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gnu/packages/cpp.scm b/gnu/packages/cpp.scm
index 1a991ac08c..0e61b49bbf 100644
--- a/gnu/packages/cpp.scm
+++ b/gnu/packages/cpp.scm
@@ -3562,6 +3562,11 @@ different floating point sizes and complex 
transformations.")
                     (string-append #$(this-package-native-input "unittest-cpp")
                                    "/lib")
                     "', LIBS=['UnitTest++'])")))))
+            (add-after 'unpack 'fix-example
+              (lambda _
+                (substitute* "example/main.cpp"
+                  (("fclose\\(file\\);")
+                   "if (file != nullptr) {fclose(file); file = nullptr;}"))))
             (replace 'build
               (lambda* (#:key tests? #:allow-other-keys #:rest args)
                 (when tests?

Reply via email to