mirror of
https://github.com/moby/moby.git
synced 2022-11-09 12:21:53 -05:00
Update restrict.Restrict to both show the error message when failing to mount /dev/null over /proc/kcore, and to ignore "not exists" errors while doing so (for when CONFIG_PROC_KCORE=n in the kernel)
Docker-DCO-1.1-Signed-off-by: Andrew Page <admwiggin@gmail.com> (github: tianon)
This commit is contained in:
parent
81041b3ba6
commit
d60301edb8
1 changed files with 3 additions and 2 deletions
|
@ -4,6 +4,7 @@ package restrict
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"os"
|
||||||
"syscall"
|
"syscall"
|
||||||
|
|
||||||
"github.com/dotcloud/docker/pkg/system"
|
"github.com/dotcloud/docker/pkg/system"
|
||||||
|
@ -18,8 +19,8 @@ func Restrict(mounts ...string) error {
|
||||||
return fmt.Errorf("unable to remount %s readonly: %s", dest, err)
|
return fmt.Errorf("unable to remount %s readonly: %s", dest, err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if err := system.Mount("/dev/null", "/proc/kcore", "", syscall.MS_BIND, ""); err != nil {
|
if err := system.Mount("/dev/null", "/proc/kcore", "", syscall.MS_BIND, ""); err != nil && !os.IsNotExist(err) {
|
||||||
return fmt.Errorf("unable to bind-mount /dev/null over /proc/kcore")
|
return fmt.Errorf("unable to bind-mount /dev/null over /proc/kcore: %s", err)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue