aboutsummaryrefslogtreecommitdiffhomepage
path: root/helper
diff options
context:
space:
mode:
Diffstat (limited to 'helper')
-rw-r--r--helper/bwrap/builder.go13
1 files changed, 12 insertions, 1 deletions
diff --git a/helper/bwrap/builder.go b/helper/bwrap/builder.go
index d196bc06..e6685aa9 100644
--- a/helper/bwrap/builder.go
+++ b/helper/bwrap/builder.go
@@ -78,11 +78,22 @@ CopyBind(dest, payload, true) copy from FD to file which is bind-mounted on DEST
(--bind-data FD DEST)
*/
func (c *Config) CopyBind(dest string, payload []byte, opts ...bool) *Config {
+ var p *[]byte
+ c.CopyBindRef(dest, &p, opts...)
+ *p = payload
+ return c
+}
+
+// CopyBindRef is the same as CopyBind but writes the address of DataConfig.Data.
+func (c *Config) CopyBindRef(dest string, payloadRef **[]byte, opts ...bool) *Config {
t := DataROBind
if len(opts) > 0 && opts[0] {
t = DataBind
}
- c.Filesystem = append(c.Filesystem, &DataConfig{Dest: dest, Data: payload, Type: t})
+ d := &DataConfig{Dest: dest, Type: t}
+ *payloadRef = &d.Data
+
+ c.Filesystem = append(c.Filesystem, d)
return c
}