prefer_openssl: OSX: get rid of /proc warnings
OSX does not have /proc/cpuinfo, but let's not warn the user about it.
This commit is contained in:
parent
52655843ab
commit
603e144f5e
|
@ -3,6 +3,7 @@ package prefer_openssl
|
||||||
import (
|
import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
"runtime"
|
||||||
|
|
||||||
"github.com/rfjakob/gocryptfs/internal/tlog"
|
"github.com/rfjakob/gocryptfs/internal/tlog"
|
||||||
)
|
)
|
||||||
|
@ -16,9 +17,12 @@ import (
|
||||||
// filePreferOpenSSL takes an explicit filename so it can be tested with saved
|
// filePreferOpenSSL takes an explicit filename so it can be tested with saved
|
||||||
// cpuinfo files instead of /proc/cpuinfo.
|
// cpuinfo files instead of /proc/cpuinfo.
|
||||||
func filePreferOpenSSL(file string) bool {
|
func filePreferOpenSSL(file string) bool {
|
||||||
|
if runtime.GOOS == "darwin" && file == "/proc/cpuinfo" {
|
||||||
|
// OSX does not have /proc, let's not warn about it.
|
||||||
|
return true
|
||||||
|
}
|
||||||
ci, err := ioutil.ReadFile(file)
|
ci, err := ioutil.ReadFile(file)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
tlog.Warn.Println(err)
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
haveAes, err := regexp.Match(`(?m)^flags.*\baes\b`, ci)
|
haveAes, err := regexp.Match(`(?m)^flags.*\baes\b`, ci)
|
||||||
|
|
Loading…
Reference in New Issue