From: David Kahurani k.kahurani@gmail.com
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54939 Signed-off-by: David Kahurani k.kahurani@gmail.com --- dlls/ntdll/unix/file.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/dlls/ntdll/unix/file.c b/dlls/ntdll/unix/file.c index 0263d53716b..c52611af898 100644 --- a/dlls/ntdll/unix/file.c +++ b/dlls/ntdll/unix/file.c @@ -1294,19 +1294,21 @@ static BOOLEAN get_dir_case_sensitivity( const char *dir ) * * Check if the specified file should be hidden based on its unix path and the show dot files option. */ -static BOOL is_hidden_file( const char *name ) +static BOOL is_hidden_file( const char *path ) { const char *p; + struct stat st;
if (show_dot_files) return FALSE;
- p = name + strlen( name ); - while (p > name && p[-1] == '/') p--; - while (p > name && p[-1] != '/') p--; - if (*p++ != '.') return FALSE; - if (!*p || *p == '/') return FALSE; /* "." directory */ - if (*p++ != '.') return FALSE; - if (!*p || *p == '/') return FALSE; /* ".." directory */ + if (stat(path, &st) || S_ISDIR(st.st_mode)) + return FALSE; + + p = path + strlen( path ); + while (p > path && p[-1] == '/') p--; + while (p > path && p[-1] != '/') p--; + if (*p != '.') return FALSE; + return TRUE; }