fix Error unmounting display bug, unconditionally unmount /dev & /dev/fd, remove parameter file
This commit is contained in:
parent
e87699e2dc
commit
0f4f76a9a2
18
cmd/stop.go
18
cmd/stop.go
@ -132,7 +132,7 @@ func umountJailFsFromHost(jail *Jail, mountpoint string) error {
|
||||
cmd = fmt.Sprintf("umount %s%s", jail.RootPath, mountpoint)
|
||||
_, err := executeCommand(cmd)
|
||||
if err != nil {
|
||||
return errors.New(fmt.Sprintf("Error umounting %s/%s: %s", jail.RootPath, mountpoint, err.Error()))
|
||||
return errors.New(fmt.Sprintf("Error umounting %s%s: %s", jail.RootPath, mountpoint, err.Error()))
|
||||
}
|
||||
return nil
|
||||
}
|
||||
@ -293,15 +293,16 @@ func StopJail(args []string) {
|
||||
}
|
||||
}
|
||||
|
||||
if cj.Config.Mount_fdescfs > 0 {
|
||||
// FIXME: /dev/fd is mounted even with Mount_fdescfs = 0 ?!
|
||||
//if cj.Config.Mount_fdescfs > 0 {
|
||||
fmt.Printf(" > Umount fdescfs:\n")
|
||||
err := umountJailFsFromHost(cj, "/dev/fd")
|
||||
err = umountJailFsFromHost(cj, "/dev/fd")
|
||||
if err != nil {
|
||||
fmt.Printf("ERROR: %s\n", err.Error())
|
||||
} else {
|
||||
fmt.Printf(" > Umount fdescfs: OK\n")
|
||||
}
|
||||
}
|
||||
//}
|
||||
|
||||
if cj.Config.Mount_devfs > 0 {
|
||||
fmt.Printf(" > Umount devfs:\n")
|
||||
@ -314,7 +315,6 @@ func StopJail(args []string) {
|
||||
}
|
||||
|
||||
// Remove local mounts from $JAIL/fstab
|
||||
// The way we get fstab is presumptuous
|
||||
fstab := strings.Replace(cj.ConfigPath, "config.json", "fstab", 1)
|
||||
mounts, err := getFstab(fstab)
|
||||
if err != nil {
|
||||
@ -334,5 +334,13 @@ func StopJail(args []string) {
|
||||
fmt.Printf(" > Umount mountpoints from %s: OK\n", fstab)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove parameter file
|
||||
pfile := fmt.Sprintf("/var/run/jail.%s.conf", cj.InternalName)
|
||||
if err = os.Remove(pfile); err != nil {
|
||||
fmt.Printf("Error deleting parameter file %s\n", pfile)
|
||||
}
|
||||
|
||||
cj.InternalName = ""
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user