Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit10212d7

Browse files
mahkohrfjakob
authored andcommitted
Set a default PATH if PATH is empty or unset
mount(1) unsets PATH before calling mount.fuse. Therefore it's not setin gocrpytfs either and daemonization fails if gocryptfs was notexecuted via an absolute path.mount.fuse handles this by leaving the execution of the helper to/bin/sh. /bin/sh handles an empty PATH by searching a few defaultlocations.This patch sets the PATH to a sane default if it's empty or unset.
1 parent53d6a99 commit10212d7

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

‎main.go‎

Lines changed: 5 additions & 0 deletions
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+
ifos.Getenv("PATH")=="" {
132+
os.Setenv("PATH","/usr/sbin:/usr/bin:/sbin:/bin")
133+
}
129134
varerrerror
130135
// Parse all command-line options (i.e. arguments starting with "-")
131136
// into "args". Path arguments are parsed below.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp