summaryrefslogtreecommitdiff
path: root/mount.go
diff options
context:
space:
mode:
authorJakob Unterwurzacher2020-01-14 23:12:56 +0100
committerJakob Unterwurzacher2020-01-14 23:12:56 +0100
commita48d7fac2cedd18fcc0466091e35cccde5790d8a (patch)
treeecd5517925537a9458899b648858e4698419c78d /mount.go
parent367b7e8647987a23ccd545fc7eeab16acc3980eb (diff)
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
Diffstat (limited to 'mount.go')
-rw-r--r--mount.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/mount.go b/mount.go
index 61e2673..5107bee 100644
--- a/mount.go
+++ b/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.
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
cmd.Stdout = &out
- err := cmd.Run()
+ err = cmd.Run()
if err != nil {
tlog.Warn.Printf("warning: haveFusermount2: %v", err)
return false