aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJakob Unterwurzacher2018-04-11 20:31:02 +0200
committerJakob Unterwurzacher2018-04-11 20:31:02 +0200
commit12832851c68ce6ba2907b5d5fefc2a5e49f7c36a (patch)
treeb35c7a69ac08a53b57e19a9f581a0417bf49a7e2
parentbcc8378a2c07476a43c1fe316b79590177ded3d3 (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
-rw-r--r--daemonize.go12
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