aboutsummaryrefslogtreecommitdiffhomepage
path: root/sandbox/sequential.go
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/sequential.go')
-rw-r--r--sandbox/sequential.go10
1 files changed, 9 insertions, 1 deletions
diff --git a/sandbox/sequential.go b/sandbox/sequential.go
index d6967035..d0729622 100644
--- a/sandbox/sequential.go
+++ b/sandbox/sequential.go
@@ -301,7 +301,15 @@ func (l *Symlink) apply(*Params) error {
return msg.WrapErr(syscall.EBADE,
fmt.Sprintf("path %q is not absolute", l[1]))
}
- if err := os.Symlink(l[0], toSysroot(l[1])); err != nil {
+
+ target := toSysroot(l[1])
+ if err := ensureFile(target, 0444, 0755); err != nil {
+ return err
+ }
+ if err := os.Remove(target); err != nil {
+ return msg.WrapErr(err, err.Error())
+ }
+ if err := os.Symlink(l[0], target); err != nil {
return msg.WrapErr(err, err.Error())
}
return nil