diff options
author | Jakob Unterwurzacher | 2018-04-11 20:31:02 +0200 |
---|---|---|
committer | Jakob Unterwurzacher | 2018-04-11 20:31:02 +0200 |
commit | 12832851c68ce6ba2907b5d5fefc2a5e49f7c36a (patch) | |
tree | b35c7a69ac08a53b57e19a9f581a0417bf49a7e2 /daemonize.go | |
parent | bcc8378a2c07476a43c1fe316b79590177ded3d3 (diff) |
daemonize: try /bin/logger if /usr/bin/logger fails
SUSE has /bin/logger, everybody else has /usr/bin/logger,
so try both.
Fixes https://github.com/rfjakob/gocryptfs/issues/225
Diffstat (limited to 'daemonize.go')
-rw-r--r-- | daemonize.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/daemonize.go b/daemonize.go index 67bb1d9..03c4fc4 100644 --- a/daemonize.go +++ b/daemonize.go @@ -65,9 +65,15 @@ func redirectStdFds() { return } tag := fmt.Sprintf("gocryptfs-%d-logger", os.Getpid()) - cmd := exec.Command("/usr/bin/logger", "-t", tag) - cmd.Stdin = pr - err = cmd.Start() + // 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 { + break + } + } if err != nil { tlog.Warn.Printf("redirectStdFds: could not start logger: %v\n", err) return |