Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
93609869
Commit
93609869
authored
Oct 05, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Avoid mkstemps().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
6a7c4947
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
4 deletions
+19
-4
mapping.c
server/mapping.c
+19
-4
No files found.
server/mapping.c
View file @
93609869
...
...
@@ -263,14 +263,29 @@ int grow_file( int unix_fd, file_pos_t new_size )
return
0
;
}
/* simplified version of mkstemps() */
static
int
make_temp_file
(
char
name
[
16
]
)
{
static
unsigned
int
value
;
int
i
,
fd
=
-
1
;
value
+=
(
current_time
>>
16
)
+
current_time
;
for
(
i
=
0
;
i
<
0x8000
&&
fd
<
0
;
i
++
,
value
+=
7777
)
{
sprintf
(
name
,
"tmpmap-%08x"
,
value
);
fd
=
open
(
name
,
O_RDWR
|
O_CREAT
|
O_EXCL
,
0600
);
}
return
fd
;
}
/* check if the current directory allows exec mappings */
static
int
check_current_dir_for_exec
(
void
)
{
int
fd
;
char
tmpfn
[
]
=
"anonmap.XXXXXX"
;
char
tmpfn
[
16
]
;
void
*
ret
=
MAP_FAILED
;
fd
=
m
kstemps
(
tmpfn
,
0
);
fd
=
m
ake_temp_file
(
tmpfn
);
if
(
fd
==
-
1
)
return
0
;
if
(
grow_file
(
fd
,
1
))
{
...
...
@@ -286,7 +301,7 @@ static int check_current_dir_for_exec(void)
static
int
create_temp_file
(
file_pos_t
size
)
{
static
int
temp_dir_fd
=
-
1
;
char
tmpfn
[
]
=
"anonmap.XXXXXX"
;
char
tmpfn
[
16
]
;
int
fd
;
if
(
temp_dir_fd
==
-
1
)
...
...
@@ -304,7 +319,7 @@ static int create_temp_file( file_pos_t size )
}
else
if
(
temp_dir_fd
!=
server_dir_fd
)
fchdir
(
temp_dir_fd
);
fd
=
m
kstemps
(
tmpfn
,
0
);
fd
=
m
ake_temp_file
(
tmpfn
);
if
(
fd
!=
-
1
)
{
if
(
!
grow_file
(
fd
,
size
))
...
...
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