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
309566d9
Commit
309566d9
authored
Dec 18, 2002
by
Bill Medland
Committed by
Alexandre Julliard
Dec 18, 2002
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
If a .reg function is accessed through a symlink then write directly
to the file rather than replacing it with a temp file. This preserves ownership and permissions.
parent
a16ed909
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
registry.c
server/registry.c
+7
-5
No files found.
server/registry.c
View file @
309566d9
...
...
@@ -1582,8 +1582,9 @@ static void register_branch_for_saving( struct key *key, const char *path, size_
/* save a registry branch to a file */
static
int
save_branch
(
struct
key
*
key
,
const
char
*
path
)
{
struct
stat
st
;
char
*
p
,
*
real
,
*
tmp
=
NULL
;
int
fd
,
count
=
0
,
ret
=
0
;
int
fd
,
count
=
0
,
ret
=
0
,
by_symlink
;
FILE
*
f
;
if
(
!
(
key
->
flags
&
KEY_DIRTY
))
...
...
@@ -1594,6 +1595,7 @@ static int save_branch( struct key *key, const char *path )
/* get the real path */
by_symlink
=
(
!
lstat
(
path
,
&
st
)
&&
S_ISLNK
(
st
.
st_mode
));
if
(
!
(
real
=
malloc
(
PATH_MAX
)))
return
0
;
if
(
!
realpath
(
path
,
real
))
{
...
...
@@ -1606,10 +1608,10 @@ static int save_branch( struct key *key, const char *path )
if
((
fd
=
open
(
path
,
O_WRONLY
))
!=
-
1
)
{
struct
stat
st
;
/* if file is not a regular file or has multiple links,
write directly into it; otherwise use a temp file */
if
(
!
fstat
(
fd
,
&
st
)
&&
(
!
S_ISREG
(
st
.
st_mode
)
||
st
.
st_nlink
>
1
))
/* if file is not a regular file or has multiple links or is accessed
* via symbolic links, write directly into it; otherwise use a temp file */
if
(
by_symlink
||
(
!
fstat
(
fd
,
&
st
)
&&
(
!
S_ISREG
(
st
.
st_mode
)
||
st
.
st_nlink
>
1
)
))
{
ftruncate
(
fd
,
0
);
goto
save
;
...
...
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