From 4301c34451e8935d6d98246f41a3dc1192b5e1c7 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Thu, 6 Jun 2024 17:05:52 +0100 Subject: [PATCH] image-ext2: use single quotes around label for mke2fs 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 --- image-ext2.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/image-ext2.c b/image-ext2.c index a83c21e..ee80e7d 100644 --- a/image-ext2.c +++ b/image-ext2.c @@ -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 ? "'" : "",