Hi,
I recently experimented with ftw() and nftw(). These are function for calling some function for every
file in a subtree.
I need to get full information about type of file.
Almost everything is working according to documentation
but I noticed following problem:
With a value FTW_PHYS as 4th arg. for nftw() the callback should obtain FTW_SL for proper symbolic links and FTW_SLN for dangling ones. I always obtain FTW_SL - this is bug in my opinion.
So I need to supply 0 as 4th arg. Then callbacks [correctly] obtain FTW_F for proper symbolic links and FTW_SLN for dangling ones. Unfortunately 'struct stat' callback obtains also returns same 'st_mode' value for regular files and symbolic links (due to stat() instead of lstat() in implementation probably) and I need to call lstat() additionally. This workaround works.
Have anybody obtained FTW_SLN in FTW_PHYS mode?
I am using glibc 2.3.5 and have not found any information about bugs.
thanks,