aboutsummaryrefslogtreecommitdiffhomepage
path: root/container/initremount.go
diff options
context:
space:
mode:
Diffstat (limited to 'container/initremount.go')
-rw-r--r--container/initremount.go11
1 files changed, 4 insertions, 7 deletions
diff --git a/container/initremount.go b/container/initremount.go
index 77efc21d..74bea097 100644
--- a/container/initremount.go
+++ b/container/initremount.go
@@ -3,7 +3,6 @@ package container
import (
"encoding/gob"
"fmt"
- "syscall"
)
func init() { gob.Register(new(RemountOp)) }
@@ -20,20 +19,18 @@ type RemountOp struct {
Flags uintptr
}
+func (r *RemountOp) Valid() bool { return r != nil && r.Target != nil }
func (*RemountOp) early(*setupState) error { return nil }
func (r *RemountOp) apply(*setupState) error {
- if r.Target == nil {
- return syscall.EBADE
- }
return wrapErrSuffix(hostProc.remount(toSysroot(r.Target.String()), r.Flags),
fmt.Sprintf("cannot remount %q:", r.Target))
}
func (r *RemountOp) Is(op Op) bool {
vr, ok := op.(*RemountOp)
- return ok && ((r == nil && vr == nil) ||
- (r.Target != nil && vr.Target != nil && r.Target.Is(vr.Target)) &&
- r.Flags == vr.Flags)
+ return ok && r.Valid() && vr.Valid() &&
+ r.Target.Is(vr.Target) &&
+ r.Flags == vr.Flags
}
func (*RemountOp) prefix() string { return "remounting" }
func (r *RemountOp) String() string { return fmt.Sprintf("%q flags %#x", r.Target, r.Flags) }