Skip to content

Commit

Permalink
c/snap-bootstrap: use strings.Join for multiple overlayfs lower dirs
Browse files Browse the repository at this point in the history
  • Loading branch information
sespiros committed Jan 16, 2025
1 parent 18f5fab commit 142a624
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cmd/snap-bootstrap/initramfs_systemd_mount.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,18 +104,12 @@ func (o *overlayFsOptions) AppendOptions(options []string) ([]string, error) {
return nil, err
}

var lowerDirs strings.Builder
for i, d := range o.LowerDirs {
// This is used for splitting multiple lowerdirs as done in
// https://elixir.bootlin.com/linux/v6.10.9/C/ident/ovl_parse_param_split_lowerdirs.
if i != 0 {
lowerDirs.WriteRune(':')
}

lowerDirs.WriteString(d)
}
// This is used for splitting multiple lowerdirs as done in
// https://elixir.bootlin.com/linux/v6.10.9/C/ident/ovl_parse_param_split_lowerdirs.
lowerDirs := strings.Join(o.LowerDirs, ":")

options = append(options, fmt.Sprintf("lowerdir=%s", lowerDirs.String()))
// options = append(options, fmt.Sprintf("lowerdir=%s", lowerDirs.String()))
options = append(options, fmt.Sprintf("lowerdir=%s", lowerDirs))
options = append(options, fmt.Sprintf("upperdir=%s", o.UpperDir))
options = append(options, fmt.Sprintf("workdir=%s", o.WorkDir))

Expand Down

0 comments on commit 142a624

Please sign in to comment.