Merge pull request #442 from rhatdan/tmpfsperms
Mounting a tmpfs directory needs to inherit directory permissions from base
This commit is contained in:
commit
58feafa848
|
@ -100,7 +100,23 @@ func mount(m *configs.Mount, rootfs, mountLabel string) error {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
return syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), "")
|
return syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), "")
|
||||||
case "tmpfs", "mqueue", "devpts", "sysfs":
|
case "tmpfs":
|
||||||
|
stat, err := os.Stat(dest)
|
||||||
|
if err != nil {
|
||||||
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if err := syscall.Mount(m.Source, dest, m.Device, uintptr(m.Flags), data); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
if stat != nil {
|
||||||
|
if err = os.Chmod(dest, stat.Mode()); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nil
|
||||||
|
case "mqueue", "devpts", "sysfs":
|
||||||
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue