Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-fonts
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
Aleksandr Isakov
wine-fonts
Commits
6f68b774
Commit
6f68b774
authored
Jul 01, 2009
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Avoid the close-on-exec race with pipe() on kernels that support pipe2().
parent
3269d8c7
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
36 additions
and
9 deletions
+36
-9
configure
configure
+2
-0
configure.ac
configure.ac
+1
-0
ntdll_misc.h
dlls/ntdll/ntdll_misc.h
+1
-0
server.c
dlls/ntdll/server.c
+28
-7
thread.c
dlls/ntdll/thread.c
+1
-2
config.h.in
include/config.h.in
+3
-0
No files found.
configure
View file @
6f68b774
...
...
@@ -18351,6 +18351,7 @@ CFLAGS="$CFLAGS $BUILTINFLAG"
for
ac_func
in
\
_pclose
\
_popen
\
...
...
@@ -18388,6 +18389,7 @@ for ac_func in \
memmove
\
mmap
\
pclose
\
pipe2
\
poll
\
popen
\
prctl
\
...
...
configure.ac
View file @
6f68b774
...
...
@@ -1610,6 +1610,7 @@ AC_CHECK_FUNCS(\
memmove \
mmap \
pclose \
pipe2 \
poll \
popen \
prctl \
...
...
dlls/ntdll/ntdll_misc.h
View file @
6f68b774
...
...
@@ -85,6 +85,7 @@ extern void server_leave_uninterrupted_section( RTL_CRITICAL_SECTION *cs, sigset
extern
int
server_remove_fd_from_cache
(
HANDLE
handle
);
extern
int
server_get_unix_fd
(
HANDLE
handle
,
unsigned
int
access
,
int
*
unix_fd
,
int
*
needs_close
,
enum
server_fd_type
*
type
,
unsigned
int
*
options
);
extern
int
server_pipe
(
int
fd
[
2
]
);
/* security descriptors */
NTSTATUS
NTDLL_create_struct_sd
(
PSECURITY_DESCRIPTOR
nt_sd
,
struct
security_descriptor
**
server_sd
,
...
...
dlls/ntdll/server.c
View file @
6f68b774
...
...
@@ -663,6 +663,32 @@ void CDECL wine_server_release_fd( HANDLE handle, int unix_fd )
/***********************************************************************
* server_pipe
*
* Create a pipe for communicating with the server.
*/
int
server_pipe
(
int
fd
[
2
]
)
{
int
ret
;
#ifdef HAVE_PIPE2
static
int
have_pipe2
=
1
;
if
(
have_pipe2
)
{
if
(
!
(
ret
=
pipe2
(
fd
,
O_CLOEXEC
)))
return
ret
;
if
(
errno
==
ENOSYS
||
errno
==
EINVAL
)
have_pipe2
=
0
;
/* don't try again */
}
#endif
if
(
!
(
ret
=
pipe
(
fd
)))
{
fcntl
(
fd
[
0
],
F_SETFD
,
FD_CLOEXEC
);
fcntl
(
fd
[
1
],
F_SETFD
,
FD_CLOEXEC
);
}
return
ret
;
}
/***********************************************************************
* start_server
*
* Start a new wine server.
...
...
@@ -1029,18 +1055,13 @@ size_t server_init_thread( void *entry_point )
sigaction
(
SIGCHLD
,
&
sig_act
,
NULL
);
/* create the server->client communication pipes */
if
(
pipe
(
reply_pipe
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
if
(
pipe
(
ntdll_get_thread_data
()
->
wait_fd
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
if
(
server_
pipe
(
reply_pipe
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
if
(
server_
pipe
(
ntdll_get_thread_data
()
->
wait_fd
)
==
-
1
)
server_protocol_perror
(
"pipe"
);
wine_server_send_fd
(
reply_pipe
[
1
]
);
wine_server_send_fd
(
ntdll_get_thread_data
()
->
wait_fd
[
1
]
);
ntdll_get_thread_data
()
->
reply_fd
=
reply_pipe
[
0
];
close
(
reply_pipe
[
1
]
);
/* set close on exec flag */
fcntl
(
ntdll_get_thread_data
()
->
reply_fd
,
F_SETFD
,
1
);
fcntl
(
ntdll_get_thread_data
()
->
wait_fd
[
0
],
F_SETFD
,
1
);
fcntl
(
ntdll_get_thread_data
()
->
wait_fd
[
1
],
F_SETFD
,
1
);
SERVER_START_REQ
(
init_thread
)
{
req
->
unix_pid
=
getpid
();
...
...
dlls/ntdll/thread.c
View file @
6f68b774
...
...
@@ -488,8 +488,7 @@ NTSTATUS WINAPI RtlCreateUserThread( HANDLE process, const SECURITY_DESCRIPTOR *
return
result
.
create_thread
.
status
;
}
if
(
pipe
(
request_pipe
)
==
-
1
)
return
STATUS_TOO_MANY_OPENED_FILES
;
fcntl
(
request_pipe
[
1
],
F_SETFD
,
1
);
/* set close on exec flag */
if
(
server_pipe
(
request_pipe
)
==
-
1
)
return
STATUS_TOO_MANY_OPENED_FILES
;
wine_server_send_fd
(
request_pipe
[
0
]
);
SERVER_START_REQ
(
new_thread
)
...
...
include/config.h.in
View file @
6f68b774
...
...
@@ -552,6 +552,9 @@
/* Define to 1 if the system has the type `pid_t'. */
#undef HAVE_PID_T
/* Define to 1 if you have the `pipe2' function. */
#undef HAVE_PIPE2
/* Define to 1 if you have the <png.h> header file. */
#undef HAVE_PNG_H
...
...
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