- this file is a directory, fail. */
- if ((flags & FS_EXEC_ONLY) || (flags & FS_EXEC_PREFERRED) ||
- ((flags & FS_NODIRS) && (status & FS_DIRECTORY)))
+ this file is a directory, or we want a readable file and this file
+ isn't readable, fail. */
+ if ((flags & (FS_EXEC_ONLY|FS_EXEC_PREFERRED)) ||
+ ((flags & FS_NODIRS) && (status & FS_DIRECTORY)) ||
+ ((flags & FS_READABLE) && (status & FS_READABLE) == 0))