2011/9/28 Christian Kellermann <ck...@pestilenz.org>: > [...] > As I see it, this procedure needs an overhaul anyway. If fstat fails > it returns #f regardless the reason. > [...]
Hello, while it is true that only an ENOENT errno indicates a missing path component in any file system operation, I also wonder why on earth anyone would want to use fstat to check for the existence of a file? To use fstat you first have to open the file, but if it can be opened, it clearly exists and calling fstat at all is redundant. However, if it cannot be opened, a large variety of reasons other than nonexistence of the file can be responsible. Calling stat instead of fstat and checking for an ENOENT errno would be an option, but if one is only interested in the existence of the file it looks like overkill to me to collect all the metainformation about the file and then throw it away. I would say that the canonical way to check for file existence is calling access with the candidate path as first argument and the mode F_OK as second argument and checking for an ENOENT errno. Ciao, Thomas -- When C++ is your hammer, every problem looks like your thumb. _______________________________________________ Chicken-users mailing list Chicken-users@nongnu.org https://lists.nongnu.org/mailman/listinfo/chicken-users