Raise error if /etc/hostid not readable
This commit is contained in:
@ -18,12 +18,12 @@ import (
|
||||
/*****************************************************************************
|
||||
* Mandatory constructor for JailConfig type. It set default values
|
||||
*****************************************************************************/
|
||||
func NewJailConfig() JailConfig {
|
||||
func NewJailConfig() (JailConfig, error) {
|
||||
var jc JailConfig
|
||||
|
||||
hostid, err := ioutil.ReadFile("/etc/hostid")
|
||||
if err != nil {
|
||||
hostid = []byte("12345678-abcd-ef98-7654-321012345678")
|
||||
return err
|
||||
} else {
|
||||
hostid = []byte(strings.Replace(string(hostid), "\n", "", -1))
|
||||
}
|
||||
|
Reference in New Issue
Block a user