sandbox/mount: rename device flag
Signed-off-by: Ophestra <cat@gensokyo.uk>
This commit is contained in:
parent
c83a7e2efc
commit
70c9757e26
@ -13,7 +13,7 @@ const (
|
|||||||
BindSource
|
BindSource
|
||||||
BindRecursive
|
BindRecursive
|
||||||
BindWritable
|
BindWritable
|
||||||
BindDevices
|
BindDevice
|
||||||
)
|
)
|
||||||
|
|
||||||
func bindMount(src, dest string, flags int) error {
|
func bindMount(src, dest string, flags int) error {
|
||||||
@ -66,7 +66,7 @@ func bindMount(src, dest string, flags int) error {
|
|||||||
if flags&BindWritable == 0 {
|
if flags&BindWritable == 0 {
|
||||||
mf |= syscall.MS_RDONLY
|
mf |= syscall.MS_RDONLY
|
||||||
}
|
}
|
||||||
if flags&BindDevices == 0 {
|
if flags&BindDevice == 0 {
|
||||||
mf |= syscall.MS_NODEV
|
mf |= syscall.MS_NODEV
|
||||||
}
|
}
|
||||||
if msg.IsVerbose() {
|
if msg.IsVerbose() {
|
||||||
|
@ -89,7 +89,7 @@ func (d MountDev) apply(params *InitParams) error {
|
|||||||
for _, name := range []string{"null", "zero", "full", "random", "urandom", "tty"} {
|
for _, name := range []string{"null", "zero", "full", "random", "urandom", "tty"} {
|
||||||
if err := bindMount(
|
if err := bindMount(
|
||||||
"/dev/"+name, path.Join(v, name),
|
"/dev/"+name, path.Join(v, name),
|
||||||
BindSource|BindDevices,
|
BindSource|BindDevice,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -132,10 +132,7 @@ func (d MountDev) apply(params *InitParams) error {
|
|||||||
syscall.SYS_IOCTL, 1, syscall.TIOCGWINSZ,
|
syscall.SYS_IOCTL, 1, syscall.TIOCGWINSZ,
|
||||||
uintptr(unsafe.Pointer(&buf[0])),
|
uintptr(unsafe.Pointer(&buf[0])),
|
||||||
); errno == 0 {
|
); errno == 0 {
|
||||||
if err := bindMount(
|
if err := bindMount("/proc/self/fd/1", path.Join(v, "console"), BindDevice); err != nil {
|
||||||
"/proc/self/fd/1", path.Join(v, "console"),
|
|
||||||
BindDevices,
|
|
||||||
); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user