man 3 ftw I observe that "POSIX.1-2008 marks ftw() as obsolete".
Now I am concerned and want to be a "nice programmer" and maybe respect obsoleteness of
ftw(). Still I struggle now with finding out what else I should use that is now "up-to-date" and in a matter of speaking what the replacement for
ftw() is that made it obsolete.
If allowed I am especially interested in two sub questions.
I hope for mercy if and am open for suggestion to improve the question, while still being happy to be helped and accepted given it is challenging and I tried well to compose the question.
Yes, you should avoid using obsolete functions. For
ftw(), the replacement is
int nftw(const char *path, int (*fn)(const char *, const struct stat *, int, struct FTW *), int fd_limit, int flags);
From Open Group:
ftw()function may allocate dynamic storage during its operation. If
ftw()is forcibly terminated, such as by
siglongjmp()being executed by the function pointed to by
fnor 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 by
fnreturn a non-zero value at its next invocation.
Applications should use the
nftw()function instead of the obsolescent