file: use the same open() path for directories as for regular files
This requires support for fdopendir(). One open() and fstat() calls per input file are avoided. Ok, this is not such a major improvement). This should also work around brain-damaged file system drivers such as Linux HFS+, whereby opendir() succeeds on regular files.