2015-09-21 22:24:08 +00:00
|
|
|
package command
|
|
|
|
|
2015-10-28 23:23:33 +00:00
|
|
|
import "syscall"
|
2015-09-21 22:24:08 +00:00
|
|
|
|
2015-10-28 23:23:33 +00:00
|
|
|
// configureChroot enters the user command into a chroot if specified in the
|
|
|
|
// config and on an OS that supports Chroots.
|
|
|
|
func (c *SpawnDaemonCommand) configureChroot() {
|
|
|
|
if len(c.config.Chroot) != 0 {
|
|
|
|
if c.config.Cmd.SysProcAttr == nil {
|
|
|
|
c.config.Cmd.SysProcAttr = &syscall.SysProcAttr{}
|
|
|
|
}
|
2015-09-21 22:24:08 +00:00
|
|
|
|
2015-10-28 23:23:33 +00:00
|
|
|
c.config.Cmd.SysProcAttr.Chroot = c.config.Chroot
|
|
|
|
c.config.Cmd.Dir = "/"
|
2015-09-21 22:24:08 +00:00
|
|
|
}
|
|
|
|
}
|