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 :

  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:
Jakob Unterwurzacher 2018-11-17 17:03:11 +01:00
parent 1ed08c7384
commit d882ed45da
1 changed files with 3 additions and 9 deletions

View File

@ -72,15 +72,9 @@ func redirectStdFds() {
tag := fmt.Sprintf("gocryptfs-%d-logger", os.Getpid())
// SUSE has /bin/logger, everybody else has /usr/bin/logger.
for _, path := range []string{"/usr/bin/logger", "/bin/logger"} {
cmd := exec.Command(path, "-t", tag)
cmd.Stdin = pr
err = cmd.Start()
if err == nil {
cmd := exec.Command("logger", "-t", tag)
cmd.Stdin = pr
err = cmd.Start()
if err != nil {
tlog.Warn.Printf("redirectStdFds: could not start logger: %v\n", err)