readdir() fails in reading .FS_info
This is regard to reading a directory .FS_info. using readdir()
. I am trying to read this .FS_info. directory and readdir()
fails to do that. How can I read this specia开发者_运维知识库l directory successfully?
From the POSIX specifications:
Upon successful completion, readdir() returns a pointer to an object of type struct dirent. When an error is encountered, a null pointer is returned and errno is set to indicate the error.
In other words, errno
should tell you exactly what the problem is.
My best guess is that a directory called .FS_info
is likely to contain some system-level information about the file system itself, and probably doesn't want users mucking about in there.
But why the filesystem implementers would protect that without going the extra yards to make it invisible would be a mystery.
Bottom line, check errno
. If that gives you no satisfaction, post the shortest pcomplete program that exhibits the behaviour, along with details on your environment (OS, filesystem type, which directory that .FS_info
directory is in, compiler, libraries and so forth).
精彩评论