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
5b4109b4
Commit
5b4109b4
authored
Jul 27, 2011
by
Han-Wen Nienhuys
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Call syscall.Unmount directly if we're root.
Don't run TestAccess for root.
parent
8cb5bb39
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
22 additions
and
0 deletions
+22
-0
fuse/loopback_test.go
fuse/loopback_test.go
+4
-0
fuse/mount.go
fuse/mount.go
+18
-0
No files found.
fuse/loopback_test.go
View file @
5b4109b4
...
...
@@ -389,6 +389,10 @@ func TestOverwriteRename(t *testing.T) {
}
func
TestAccess
(
t
*
testing
.
T
)
{
if
os
.
Geteuid
()
==
0
{
t
.
Log
(
"Skipping TestAccess() as root."
)
return
}
me
:=
NewTestCase
(
t
)
defer
me
.
Cleanup
()
...
...
fuse/mount.go
View file @
5b4109b4
...
...
@@ -8,6 +8,7 @@ import (
"path/filepath"
"strings"
"syscall"
"time"
"unsafe"
)
...
...
@@ -85,6 +86,23 @@ func mount(mountPoint string, options string) (f *os.File, finalMountPoint strin
}
func
unmount
(
mountPoint
string
)
(
err
os
.
Error
)
{
if
os
.
Geteuid
()
==
0
{
maxTry
:=
2
delay
:=
int64
(
0
)
errNo
:=
0
// A file close operation must be processed and acked
// by the daemon. This takes some time, so retry if
// the first unmount fails.
for
try
:=
0
;
try
<
maxTry
;
try
++
{
errNo
=
syscall
.
Unmount
(
mountPoint
,
0
)
if
errNo
==
0
{
return
nil
}
delay
=
2
*
delay
+
0.01e9
time
.
Sleep
(
delay
)
}
return
os
.
Errno
(
errNo
)
}
dir
,
_
:=
filepath
.
Split
(
mountPoint
)
proc
,
err
:=
os
.
StartProcess
(
mountBinary
,
[]
string
{
mountBinary
,
"-u"
,
mountPoint
},
...
...
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