From 9786b058df267ce77a468b6328e3f295a77b1314 Mon Sep 17 00:00:00 2001 From: Michal Janusz Miroslaw Date: Sat, 19 Apr 2003 02:47:08 +0000 Subject: [PATCH] On Linux: avoid blocking in DOSFS_OpenDir_VFAT if specified path is not a directory. --- files/dos_fs.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/files/dos_fs.c b/files/dos_fs.c index 6bae3a9ec78..fb9fb913041 100644 --- a/files/dos_fs.c +++ b/files/dos_fs.c @@ -75,6 +75,11 @@ typedef struct #define VFAT_IOCTL_READDIR_BOTH _IOR('r', 1, KERNEL_DIRENT [2] ) +/* To avoid blocking on non-directories in DOSFS_OpenDir_VFAT*/ +#ifndef O_DIRECTORY +# define O_DIRECTORY 0200000 /* must be directory */ +#endif + #else /* linux */ #undef VFAT_IOCTL_READDIR_BOTH /* just in case... */ #endif /* linux */ @@ -461,7 +466,7 @@ static BOOL DOSFS_OpenDir_VFAT(UINT codepage, DOS_DIR **dir, const char *unix_pa { #ifdef VFAT_IOCTL_READDIR_BOTH KERNEL_DIRENT de[2]; - int fd = open( unix_path, O_RDONLY ); + int fd = open( unix_path, O_RDONLY|O_DIRECTORY ); BOOL r = TRUE; /* Check if the VFAT ioctl is supported on this directory */