fix dep, impl nonempty
This commit is contained in:
parent
c8c18403e4
commit
a5d237df2a
24 changed files with 286 additions and 215 deletions
28
vendor/github.com/hanwen/go-fuse/fuse/mount_linux.go
generated
vendored
28
vendor/github.com/hanwen/go-fuse/fuse/mount_linux.go
generated
vendored
|
|
@ -10,7 +10,6 @@ import (
|
|||
"os"
|
||||
"os/exec"
|
||||
"path"
|
||||
"path/filepath"
|
||||
"strings"
|
||||
"syscall"
|
||||
"unsafe"
|
||||
|
|
@ -71,33 +70,18 @@ func mount(mountPoint string, opts *MountOptions, ready chan<- error) (fd int, e
|
|||
return -1, err
|
||||
}
|
||||
|
||||
// golang sets CLOEXEC on file descriptors when they are
|
||||
// acquired through normal operations (e.g. open).
|
||||
// Buf for fd, we have to set CLOEXEC manually
|
||||
syscall.CloseOnExec(fd)
|
||||
|
||||
close(ready)
|
||||
return fd, err
|
||||
}
|
||||
|
||||
func privilegedUnmount(mountPoint string) error {
|
||||
dir, _ := filepath.Split(mountPoint)
|
||||
bin, err := umountBinary()
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
proc, err := os.StartProcess(bin,
|
||||
[]string{bin, mountPoint},
|
||||
&os.ProcAttr{Dir: dir, Files: []*os.File{nil, nil, os.Stderr}})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
w, err := proc.Wait()
|
||||
if !w.Success() {
|
||||
return fmt.Errorf("umount exited with code %v\n", w.Sys())
|
||||
}
|
||||
return err
|
||||
}
|
||||
|
||||
func unmount(mountPoint string) (err error) {
|
||||
if os.Geteuid() == 0 {
|
||||
return privilegedUnmount(mountPoint)
|
||||
return syscall.Unmount(mountPoint, 0)
|
||||
}
|
||||
bin, err := fusermountBinary()
|
||||
if err != nil {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue