Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
85db4f7e
Commit
85db4f7e
authored
Jul 13, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Use a pthread mutex for the current directory section.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
d7ef680e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
15 deletions
+7
-15
file.c
dlls/ntdll/unix/file.c
+7
-15
No files found.
dlls/ntdll/unix/file.c
View file @
85db4f7e
...
...
@@ -240,15 +240,7 @@ static const BOOL is_case_sensitive = FALSE;
static
struct
file_identity
windir
;
static
RTL_CRITICAL_SECTION
dir_section
;
static
RTL_CRITICAL_SECTION_DEBUG
critsect_debug
=
{
0
,
0
,
&
dir_section
,
{
&
critsect_debug
.
ProcessLocksList
,
&
critsect_debug
.
ProcessLocksList
},
0
,
0
,
{
(
DWORD_PTR
)(
__FILE__
": dir_section"
)
}
};
static
RTL_CRITICAL_SECTION
dir_section
=
{
&
critsect_debug
,
-
1
,
0
,
0
,
0
,
0
};
static
pthread_mutex_t
dir_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
static
pthread_mutex_t
mnt_mutex
=
PTHREAD_MUTEX_INITIALIZER
;
/* check if a given Unicode char is OK in a DOS short name */
...
...
@@ -2473,7 +2465,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, PIO_APC_ROUTI
io
->
Information
=
0
;
RtlEnterCriticalSection
(
&
dir_section
);
pthread_mutex_lock
(
&
dir_mutex
);
cwd
=
open
(
"."
,
O_RDONLY
);
if
(
fchdir
(
fd
)
!=
-
1
)
...
...
@@ -2500,7 +2492,7 @@ NTSTATUS WINAPI NtQueryDirectoryFile( HANDLE handle, HANDLE event, PIO_APC_ROUTI
}
else
status
=
STATUS_ACCESS_DENIED
;
RtlLeaveCriticalSection
(
&
dir_section
);
pthread_mutex_unlock
(
&
dir_mutex
);
if
(
needs_close
)
close
(
fd
);
if
(
cwd
!=
-
1
)
close
(
cwd
);
...
...
@@ -3064,7 +3056,7 @@ static NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *
goto
done
;
}
RtlEnterCriticalSection
(
&
dir_section
);
pthread_mutex_lock
(
&
dir_mutex
);
if
((
old_cwd
=
open
(
"."
,
O_RDONLY
))
!=
-
1
&&
fchdir
(
root_fd
)
!=
-
1
)
{
/* shortcut for ".." */
...
...
@@ -3085,7 +3077,7 @@ static NTSTATUS file_id_to_unix_file_name( const OBJECT_ATTRIBUTES *attr, char *
if
(
fchdir
(
old_cwd
)
==
-
1
)
chdir
(
"/"
);
}
else
status
=
STATUS_ACCESS_DENIED
;
RtlLeaveCriticalSection
(
&
dir_section
);
pthread_mutex_unlock
(
&
dir_mutex
);
if
(
old_cwd
!=
-
1
)
close
(
old_cwd
);
done:
...
...
@@ -3258,7 +3250,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char *
}
else
{
RtlEnterCriticalSection
(
&
dir_section
);
pthread_mutex_lock
(
&
dir_mutex
);
if
((
old_cwd
=
open
(
"."
,
O_RDONLY
))
!=
-
1
&&
fchdir
(
root_fd
)
!=
-
1
)
{
status
=
lookup_unix_name
(
name
,
name_len
,
&
unix_name
,
unix_len
,
1
,
...
...
@@ -3266,7 +3258,7 @@ static NTSTATUS nt_to_unix_file_name_attr( const OBJECT_ATTRIBUTES *attr, char *
if
(
fchdir
(
old_cwd
)
==
-
1
)
chdir
(
"/"
);
}
else
status
=
STATUS_ACCESS_DENIED
;
RtlLeaveCriticalSection
(
&
dir_section
);
pthread_mutex_unlock
(
&
dir_mutex
);
if
(
old_cwd
!=
-
1
)
close
(
old_cwd
);
if
(
needs_close
)
close
(
root_fd
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment