1
0
mirror of https://github.com/DNSCrypt/dnscrypt-proxy.git synced 2024-12-28 00:20:13 +01:00

Do not blindly execute /sbin/init to detect upstart

This commit is contained in:
Frank Denis 2018-01-26 22:16:27 +01:00
parent e16155e22a
commit eca7a078dd

View File

@ -8,9 +8,7 @@ import (
"errors"
"fmt"
"os"
"os/exec"
"os/signal"
"strings"
"text/template"
"time"
)
@ -19,13 +17,6 @@ func isUpstart() bool {
if _, err := os.Stat("/sbin/upstart-udev-bridge"); err == nil {
return true
}
if _, err := os.Stat("/sbin/init"); err == nil {
if out, err := exec.Command("/sbin/init", "--version").Output(); err == nil {
if strings.Contains(string(out), "init (upstart") {
return true
}
}
}
return false
}