Checking if a dir. entry returned by readdir is a directory, link or file. dent->d_type isn’t showing the type

d_type is a speed optimization to save on lstat(2) calls, when it’s supported. As the readdir(3) man page points out, not all filesystems return real info in the d_type field (typically because it would take an extra disk seek to read the inode, as is the case for XFS if you didn’t use mkfs.xfs -n … Read more