Fix setting Running to false

This commit is contained in:
yo 2022-07-14 12:32:14 +02:00
parent efd28c03ad
commit 9b86d786fe

View File

@ -360,8 +360,19 @@ func StopJail(args []string) {
fmt.Printf("Error deleting parameter file %s\n", pfile) fmt.Printf("Error deleting parameter file %s\n", pfile)
} }
cj.InternalName = "" // We need this to get a reference to cj.Running (bc cj.Running is just a copy of value in the scope of StopJail())
cj.Running = false for i, j := range gJails {
cj.JID = 0 if strings.EqualFold(j.Name, cj.Name) && strings.EqualFold(j.Datastore, cj.Datastore) {
if err = setStructFieldValue(&gJails[i], "Running", "false"); err != nil {
fmt.Printf("ERROR: setting Running property to false: %s\n", err.Error())
}
if err = setStructFieldValue(&gJails[i], "JID", "0"); err != nil {
fmt.Printf("ERROR: setting JID property to 0: %s\n", err.Error())
}
if err = setStructFieldValue(&gJails[i], "InternalName", ""); err != nil {
fmt.Printf("ERROR: clearing InternalName property: %s\n", err.Error())
}
}
}
} }
} }