git: 54a2c5978f51 - main - fts: Fix GCC compile error

From: Olivier Certner <olce_at_FreeBSD.org>
Date: Tue, 29 Apr 2025 15:33:16 UTC
The branch main has been updated by olce:

URL: https://cgit.FreeBSD.org/src/commit/?id=54a2c5978f512654df6954ce571ce06e445c7aec

commit 54a2c5978f512654df6954ce571ce06e445c7aec
Author:     Olivier Certner <olce@FreeBSD.org>
AuthorDate: 2025-04-29 11:19:58 +0000
Commit:     Olivier Certner <olce@FreeBSD.org>
CommitDate: 2025-04-29 15:32:00 +0000

    fts: Fix GCC compile error
    
    GCC does not support the blocks extension, contrary to clang with which
    it is automatically enabled by our infrastructure (see
    'lib/libc/gen/Makefile.inc') when compiling 'fts.c'.  The alternate code
    (blocks extension not supported/enabled) tried to dereference a 'void *'
    pointer (field 'fts_compar_b' of 'FTS') to access field 'isa' of the
    block mocked by 'block_abi.h'.  Fix this by casting the pointer to the
    block type.
    
    Reviewed by:    jhb, des
    Fixes:          f0ac5e919f3f ("fts: Add blocks support.")
    Sponsored by:   The FreeBSD Foundation
    Differential Revision:  https://reviews.freebsd.org/D50068
---
 lib/libc/gen/fts.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lib/libc/gen/fts.c b/lib/libc/gen/fts.c
index 1b5c38ed58bb..d440bc24eeca 100644
--- a/lib/libc/gen/fts.c
+++ b/lib/libc/gen/fts.c
@@ -352,7 +352,8 @@ fts_close(FTS *sp)
 #ifdef __BLOCKS__
 		Block_release(sp->fts_compar_b);
 #else
-		if (sp->fts_compar_b->isa != &_NSConcreteGlobalBlock)
+		if (((fts_block)(sp->fts_compar_b))->isa !=
+		    &_NSConcreteGlobalBlock)
 			_Block_release(sp->fts_compar_b);
 #endif /* __BLOCKS__ */
 	}