Fix getJailFromArray: the returned reference was to a copy of the jail

This commit is contained in:
yo 2022-06-19 13:50:49 +02:00
parent 71f345dff4
commit a7aaa11de6

View File

@ -383,9 +383,9 @@ func getFstab(path string) ([]Mount, error) {
* Get a specific jail reference, to update properties after a range loop * Get a specific jail reference, to update properties after a range loop
*******************************************************************************/ *******************************************************************************/
func getJailFromArray(name string, jarray []Jail) (*Jail, error) { func getJailFromArray(name string, jarray []Jail) (*Jail, error) {
for _, j := range jarray { for i, j := range jarray {
if name == j.Name { if name == j.Name {
return &j, nil return &jarray[i], nil
} }
} }
return &Jail{}, errors.New("Jail not found") return &Jail{}, errors.New("Jail not found")