Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go-fuse
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Levin Zimmermann
go-fuse
Commits
32b02fb6
Commit
32b02fb6
authored
Jan 30, 2019
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
unionfs: copy fuse.Attr before modifying return value of branch cache
Fixes a race condition.
parent
c5492cd9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
0 deletions
+10
-0
unionfs/unionfs.go
unionfs/unionfs.go
+10
-0
No files found.
unionfs/unionfs.go
View file @
32b02fb6
...
@@ -496,6 +496,9 @@ func (fs *unionFS) Truncate(path string, size uint64, context *fuse.Context) (co
...
@@ -496,6 +496,9 @@ func (fs *unionFS) Truncate(path string, size uint64, context *fuse.Context) (co
code
=
fs
.
fileSystems
[
0
]
.
Truncate
(
path
,
size
,
context
)
code
=
fs
.
fileSystems
[
0
]
.
Truncate
(
path
,
size
,
context
)
}
}
if
code
.
Ok
()
{
if
code
.
Ok
()
{
newAttr
:=
*
r
.
attr
r
.
attr
=
&
newAttr
r
.
attr
.
Size
=
size
r
.
attr
.
Size
=
size
now
:=
time
.
Now
()
now
:=
time
.
Now
()
r
.
attr
.
SetTimes
(
nil
,
&
now
,
&
now
)
r
.
attr
.
SetTimes
(
nil
,
&
now
,
&
now
)
...
@@ -518,6 +521,8 @@ func (fs *unionFS) Utimens(name string, atime *time.Time, mtime *time.Time, cont
...
@@ -518,6 +521,8 @@ func (fs *unionFS) Utimens(name string, atime *time.Time, mtime *time.Time, cont
}
}
if
code
.
Ok
()
{
if
code
.
Ok
()
{
now
:=
time
.
Now
()
now
:=
time
.
Now
()
newAttr
:=
*
r
.
attr
r
.
attr
=
&
newAttr
r
.
attr
.
SetTimes
(
atime
,
mtime
,
&
now
)
r
.
attr
.
SetTimes
(
atime
,
mtime
,
&
now
)
fs
.
setBranch
(
name
,
r
)
fs
.
setBranch
(
name
,
r
)
}
}
...
@@ -531,6 +536,9 @@ func (fs *unionFS) Chown(name string, uid uint32, gid uint32, context *fuse.Cont
...
@@ -531,6 +536,9 @@ func (fs *unionFS) Chown(name string, uid uint32, gid uint32, context *fuse.Cont
return
r
.
code
return
r
.
code
}
}
newAttr
:=
*
r
.
attr
r
.
attr
=
&
newAttr
if
os
.
Geteuid
()
!=
0
{
if
os
.
Geteuid
()
!=
0
{
return
fuse
.
EPERM
return
fuse
.
EPERM
}
}
...
@@ -559,6 +567,8 @@ func (fs *unionFS) Chmod(name string, mode uint32, context *fuse.Context) (code
...
@@ -559,6 +567,8 @@ func (fs *unionFS) Chmod(name string, mode uint32, context *fuse.Context) (code
if
r
.
attr
==
nil
{
if
r
.
attr
==
nil
{
return
r
.
code
return
r
.
code
}
}
newAttr
:=
*
r
.
attr
r
.
attr
=
&
newAttr
if
r
.
code
!=
fuse
.
OK
{
if
r
.
code
!=
fuse
.
OK
{
return
r
.
code
return
r
.
code
}
}
...
...
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