I have a directory on my memory card that was been displayed as a file in various file browsers. Looking into it, the directory has a mode value of 0x28. This means it is made up of FIO_SO_IFDIR & FIO_SO_IFLNK indicating it is a directory symbolic link. I haven't been able to find where it links to.
This macro is failing also because of the symbolic link status.
#define FIO_SO_ISDIR(m) (((m) & FIO_SO_IFMT) == FIO_SO_IFDIR)
Wouldn't this macro be better defined as:
#define FIO_SO_ISDIR(m) (((m) & FIO_SO_IDIR) == FIO_SO_IFDIR)
Similarly for FIO_SO_ISLNK and FIO_SO_ISREG?