libc/ftw: Fix error: cast between incompatible function types from 'ftw_cb_t' nftw_cb_t

Signed-off-by: Xiang Xiao <xiaoxiang@xiaomi.com>
Change-Id: I9e617ac04127e1e9126de2e3d32b35f2c6d636c0
This commit is contained in:
Xiang Xiao 2020-08-11 21:43:46 +08:00 committed by David Sidrane
parent e0ad381abc
commit 4df42ba9fb

View File

@ -35,5 +35,12 @@ int ftw(FAR const char *path, ftw_cb_t fn, int fdlimit)
* actually undefined, but works on all real-world machines.
*/
return nftw(path, (nftw_cb_t)fn, fdlimit, FTW_PHYS);
union
{
ftw_cb_t ftw;
nftw_cb_t nftw;
} u;
u.ftw = fn;
return nftw(path, u.nftw, fdlimit, FTW_PHYS);
}