main: drop hardcoded /usr/bin/logger path
The hardcoded full paths were introduced to handle the
case of an empty PATH environment variable. However,
since commit 10212d791a
we set PATH to a default
value if empty. The hardcoded paths are no longer neccessary,
and cause problems on some distros:
User voobscout on
https://github.com/rfjakob/gocryptfs/issues/225#issuecomment-438682034 :
just to chime in - please don't hardcode paths, for example I'm on
NixOS and logger lives in /run/current-system/sw/bin/logger
Drop the hardcoded paths.
This commit is contained in:
parent
1ed08c7384
commit
d882ed45da
@ -72,15 +72,9 @@ func redirectStdFds() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
tag := fmt.Sprintf("gocryptfs-%d-logger", os.Getpid())
|
tag := fmt.Sprintf("gocryptfs-%d-logger", os.Getpid())
|
||||||
// SUSE has /bin/logger, everybody else has /usr/bin/logger.
|
cmd := exec.Command("logger", "-t", tag)
|
||||||
for _, path := range []string{"/usr/bin/logger", "/bin/logger"} {
|
|
||||||
cmd := exec.Command(path, "-t", tag)
|
|
||||||
cmd.Stdin = pr
|
cmd.Stdin = pr
|
||||||
err = cmd.Start()
|
err = cmd.Start()
|
||||||
if err == nil {
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tlog.Warn.Printf("redirectStdFds: could not start logger: %v\n", err)
|
tlog.Warn.Printf("redirectStdFds: could not start logger: %v\n", err)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user