Skip to contentSkip to conversation

m4: Check for FTW_ACTIONRETVAL along with nftw

PATCH In review Khem Raj 2 participants 2 messages Mar 25, 2023

lore
Share & tools
lore

Khem Raj

author
#0 lore raw

PATCH 1/1 m4: Check for FTW_ACTIONRETVAL along with nftw

FTW_ACTIONRETVAL is glibc specific extention which is used to implement xfsfind but it may not be available on other C library implementations on Linux e.g. musl. Therefore ensure that these defines are available before declaring nftw() to be usable

Cc Darrick J. Wong <[email protected]>
Cc Zorro Lang <[email protected]>
---
 m4/package_libcdev.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
m4/package_libcdev.m4 +1 -1
index b41c087b..7f731044 100644
@@ -132,7 +132,7 @@ AC_DEFUN([AC_HAVE_NFTW],
 #include <stddef.h>
 #include <ftw.h>
     ]], [[
-         nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, 0);
+         nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, FTW_ACTIONRETVAL);
     ]])],[have_nftw=yes
        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
     AC_SUBST(have_nftw)
Signature · 1 line
2.40.0
Acked-by on v1 1/1
#1 lore raw
Quoted 17 lines · Khem Raj

FTW_ACTIONRETVAL is glibc specific extention which is used to implement xfsfind but it may not be available on other C library implementations on Linux e.g. musl. Therefore ensure that these defines are available before declaring nftw() to be usable

Cc Darrick J. Wong <[email protected]>
Cc Zorro Lang <[email protected]>
---
 m4/package_libcdev.m4 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
m4/package_libcdev.m4 +0 -0
index b41c087b..7f731044 100644

m4/package_libcdev.m4 AC_DEFUN([AC_HAVE_NFTW], · line 135

Quoted 5 lines
m4/package_libcdev.m4 +1 -1
@@ -132,7 +132,7 @@ AC_DEFUN([AC_HAVE_NFTW],
 #include <stddef.h>
 #include <ftw.h>
     ]], [[
-         nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, 0);
+         nftw("/", (int (*)(const char *, const struct stat *, int, struct FTW *))1, 0, FTW_ACTIONRETVAL);

Seems fine, though xfsfind.c only uses FTW_CONTINUE and FTW_STOP, so perhaps it'd better to modify the program not to use FTW_ACTIONRETVAL?

OTOH I'm not /that/ keen on using fuzzing xfs from musl so I'll add this to my backlog and in the meantime

Looks good to me,

--D

Quoted 6 lines
m4/package_libcdev.m4 +0 -0
     ]])],[have_nftw=yes
        AC_MSG_RESULT(yes)],[AC_MSG_RESULT(no)])
     AC_SUBST(have_nftw)
Signature · 1 line
2.40.0