summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorTiwei Bie <tiwei.btw@antgroup.com>2021-07-09 10:02:39 +0800
committerTiwei Bie <tiwei.btw@antgroup.com>2021-07-09 10:14:17 +0800
commitc4c5f4d92a13aa5357002fe5ddf116433ec4e9a7 (patch)
tree1d9f9ade7a087ffebdfaab912edf80a4e86ba19f
parent02fec8dba5a6148e44da2715e26246a5d91e64fa (diff)
runsc: check the error when preparing tree for pivot_root
Signed-off-by: Tiwei Bie <tiwei.btw@antgroup.com>
-rw-r--r--runsc/cmd/gofer.go8
1 files changed, 6 insertions, 2 deletions
diff --git a/runsc/cmd/gofer.go b/runsc/cmd/gofer.go
index 570df407c..181bae3e2 100644
--- a/runsc/cmd/gofer.go
+++ b/runsc/cmd/gofer.go
@@ -284,8 +284,12 @@ func setupRootFS(spec *specs.Spec, conf *config.Config) error {
}
// Prepare tree structure for pivot_root(2).
- os.Mkdir("/proc/proc", 0755)
- os.Mkdir("/proc/root", 0755)
+ if err := os.Mkdir("/proc/proc", 0755); err != nil {
+ Fatalf("error creating /proc/proc: %v", err)
+ }
+ if err := os.Mkdir("/proc/root", 0755); err != nil {
+ Fatalf("error creating /proc/root: %v", err)
+ }
// This cannot use SafeMount because there's no available procfs. But we
// know that /proc is an empty tmpfs mount, so this is safe.
if err := unix.Mount("runsc-proc", "/proc/proc", "proc", flags|unix.MS_RDONLY, ""); err != nil {