Yes, you should avoid using obsolete functions. For ftw()
, the replacement is nftw()
:
int nftw(const char *path, int (*fn)(const char *,
const struct stat *, int, struct FTW *), int fd_limit, int flags);
From Open Group:
The
ftw()
function may allocate dynamic storage during its operation. Ifftw()
is forcibly terminated, such as bylongjmp()
orsiglongjmp()
being executed by the function pointed to byfn
or an interrupt routine,ftw()
does not have a chance to free that storage, so it remains permanently allocated. A safe way to handle interrupts is to store the fact that an interrupt has occurred, and arrange to have the function pointed to byfn
return a non-zero value at its next invocation.Applications should use the
nftw()
function instead of the obsolescentftw()
function.