Skip to content

Commit

Permalink
image-ext2: use single quotes around label for mke2fs
Browse files Browse the repository at this point in the history
When the volume label is set using tune2fs, the parameter is wrapped in
single quotes, so do the same when the label is set using mke2fs.  This
allows the label to contain spaces and other special characters (except
for single quotes!).

Signed-off-by: Ian Abbott <[email protected]>
  • Loading branch information
ian-abbott committed Jun 6, 2024
1 parent 0d9f207 commit 4301c34
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions image-ext2.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,16 @@ static int ext2_generate_mke2fs(struct image *image)
if (ret < 0)
return ret;

return systemp(image, "%s%s -t %s%s -I 256 -E 'root_owner=%s,%s'%s %s%s%s %s %s%s %s%s%s '%s' %lldk",
return systemp(image, "%s%s -t %s%s -I 256 -E 'root_owner=%s,%s'%s %s%s%s %s %s%s%s %s%s%s '%s' %lldk",
ext->conf_env, get_opt("mke2fs"), image->handler->type,
ext->usage_type_args, root_owner, options, ext->size_features,
image->empty ? "" : "-d '",
image->empty ? "" : mountpath(image),
image->empty ? "" : "'",
extraargs, label ? "-L " : "", label ? label : "",
extraargs,
label ? "-L '" : "",
label ? label : "",
label ? "'" : "",
features ? "-O '" : "",
features ? features : "",
features ? "'" : "",
Expand Down

0 comments on commit 4301c34

Please sign in to comment.