main: haveFusermount2: respect PATH environment variable
Use exec.LookPath() to find fusermount in the user's PATH first. Fall back to /bin/fusermount for the case that PATH is not set, like go-fuse does. Fixes https://github.com/rfjakob/gocryptfs/issues/448
This commit is contained in:
parent
367b7e8647
commit
a48d7fac2c
8
mount.go
8
mount.go
@ -441,10 +441,14 @@ func initGoFuse(fs pathfs.FileSystem, args *argContainer) *fuse.Server {
|
|||||||
|
|
||||||
// haveFusermount2 finds out if the "fusermount" binary is from libfuse 2.x.
|
// haveFusermount2 finds out if the "fusermount" binary is from libfuse 2.x.
|
||||||
func haveFusermount2() bool {
|
func haveFusermount2() bool {
|
||||||
cmd := exec.Command("/bin/fusermount", "-V")
|
path, err := exec.LookPath("fusermount")
|
||||||
|
if err != nil {
|
||||||
|
path = "/bin/fusermount"
|
||||||
|
}
|
||||||
|
cmd := exec.Command(path, "-V")
|
||||||
var out bytes.Buffer
|
var out bytes.Buffer
|
||||||
cmd.Stdout = &out
|
cmd.Stdout = &out
|
||||||
err := cmd.Run()
|
err = cmd.Run()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tlog.Warn.Printf("warning: haveFusermount2: %v", err)
|
tlog.Warn.Printf("warning: haveFusermount2: %v", err)
|
||||||
return false
|
return false
|
||||||
|
Loading…
Reference in New Issue
Block a user