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
75655487
Commit
75655487
authored
May 04, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
UnionFs: implement Chown.
parent
1f07b43d
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
33 additions
and
0 deletions
+33
-0
unionfs/unionfs.go
unionfs/unionfs.go
+27
-0
unionfs/unionfs_test.go
unionfs/unionfs_test.go
+6
-0
No files found.
unionfs/unionfs.go
View file @
75655487
...
...
@@ -368,6 +368,33 @@ func (me *UnionFs) Utimens(name string, atime uint64, ctime uint64) (code fuse.S
return
code
}
func
(
me
*
UnionFs
)
Chown
(
name
string
,
uid
uint32
,
gid
uint32
)
(
code
fuse
.
Status
)
{
name
=
stripSlash
(
name
)
r
:=
me
.
getBranch
(
name
)
if
r
.
attr
==
nil
||
r
.
code
!=
fuse
.
OK
{
return
r
.
code
}
if
os
.
Geteuid
()
!=
0
{
return
fuse
.
EPERM
}
if
r
.
attr
.
Owner
.
Uid
!=
uid
||
r
.
attr
.
Owner
.
Gid
!=
gid
{
if
r
.
branch
>
0
{
code
:=
me
.
Promote
(
name
,
r
)
if
code
!=
fuse
.
OK
{
return
code
}
r
.
branch
=
0
}
me
.
fileSystems
[
0
]
.
Chown
(
name
,
uid
,
gid
)
}
r
.
attr
.
Owner
.
Uid
=
uid
r
.
attr
.
Owner
.
Gid
=
gid
me
.
branchCache
.
Set
(
name
,
r
)
return
fuse
.
OK
}
func
(
me
*
UnionFs
)
Chmod
(
name
string
,
mode
uint32
)
(
code
fuse
.
Status
)
{
name
=
stripSlash
(
name
)
r
:=
me
.
getBranch
(
name
)
...
...
unionfs/unionfs_test.go
View file @
75655487
...
...
@@ -160,6 +160,12 @@ func TestChmod(t *testing.T) {
err
:=
os
.
Chmod
(
m_fn
,
07070
)
CheckSuccess
(
err
)
err
=
os
.
Chown
(
m_fn
,
0
,
0
)
code
:=
fuse
.
OsErrorToErrno
(
err
)
if
code
!=
fuse
.
EPERM
{
t
.
Error
(
"Unexpected error code"
,
code
,
err
)
}
fi
,
err
:=
os
.
Lstat
(
m_fn
)
CheckSuccess
(
err
)
if
fi
.
Mode
&
07777
!=
07070
{
...
...
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