Commit 336fe3bc authored by Han-Wen Nienhuys's avatar Han-Wen Nienhuys

Use exec.LookPath() to find umount/fusermount.

parent 10138a24
...@@ -2,17 +2,16 @@ package fuse ...@@ -2,17 +2,16 @@ package fuse
// Written with a look to http://ptspts.blogspot.com/2009/11/fuse-protocol-tutorial-for-linux-26.html // Written with a look to http://ptspts.blogspot.com/2009/11/fuse-protocol-tutorial-for-linux-26.html
import ( import (
"exec"
"fmt" "fmt"
"os" "os"
"path"
"path/filepath" "path/filepath"
"strings"
"syscall" "syscall"
"unsafe" "unsafe"
) )
var fusermountBinary string = "/bin/fusermount" var fusermountBinary string
var umountBinary string = "/bin/umount" var umountBinary string
func Socketpair(network string) (l, r *os.File, err os.Error) { func Socketpair(network string) (l, r *os.File, err os.Error) {
var domain int var domain int
...@@ -153,20 +152,6 @@ func getConnection(local *os.File) (f *os.File, err os.Error) { ...@@ -153,20 +152,6 @@ func getConnection(local *os.File) (f *os.File, err os.Error) {
} }
func init() { func init() {
for _, v := range strings.Split(os.Getenv("PATH"), ":") { fusermountBinary, _ = exec.LookPath("fusermount")
tpath := path.Join(v, "fusermount") umountBinary, _ = exec.LookPath("umount")
fi, _ := os.Stat(tpath)
if fi != nil && (fi.Mode&0111) != 0 {
fusermountBinary = tpath
break
}
tpath = path.Join(v, "umount")
fi, _ = os.Stat(tpath)
if fi != nil && (fi.Mode&0111) != 0 {
umountBinary = tpath
break
}
}
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment