Set a default PATH if PATH is empty or unset · rfjakob/gocryptfs@10212d7

Original file line numberDiff line numberDiff line change

@@ -126,6 +126,11 @@ func main() {

126126

// On a 2-core machine, setting maxprocs to 4 gives 10% better performance

127127

runtime.GOMAXPROCS(4)

128128

}

129+

// mount(1) unsets PATH. Since exec.Command does not handle this case, we set

130+

// PATH to a default value if it's empty or unset.

131+

if os.Getenv("PATH") == "" {

132+

os.Setenv("PATH", "/usr/sbin:/usr/bin:/sbin:/bin")

133+

}

129134

var err error

130135

// Parse all command-line options (i.e. arguments starting with "-")

131136

// into "args". Path arguments are parsed below.