Merge pull request #416 from LK4D4/fix_mount_join
Don't join rootfs if path already prefixed by it
This commit is contained in:
commit
0dee9793d5
|
@ -7,6 +7,7 @@ import (
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
@ -86,9 +87,13 @@ func setupRootfs(config *configs.Config, console *linuxConsole) (err error) {
|
||||||
|
|
||||||
func mount(m *configs.Mount, rootfs, mountLabel string) error {
|
func mount(m *configs.Mount, rootfs, mountLabel string) error {
|
||||||
var (
|
var (
|
||||||
dest = filepath.Join(rootfs, m.Destination)
|
dest = m.Destination
|
||||||
data = label.FormatMountLabel(m.Data, mountLabel)
|
data = label.FormatMountLabel(m.Data, mountLabel)
|
||||||
)
|
)
|
||||||
|
if !strings.HasPrefix(dest, rootfs) {
|
||||||
|
dest = filepath.Join(rootfs, dest)
|
||||||
|
}
|
||||||
|
|
||||||
switch m.Device {
|
switch m.Device {
|
||||||
case "proc":
|
case "proc":
|
||||||
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
if err := os.MkdirAll(dest, 0755); err != nil && !os.IsExist(err) {
|
||||||
|
|
Loading…
Reference in New Issue