summaryrefslogtreecommitdiff
path: root/Detail.c
diff options
context:
space:
mode:
authorNeilBrown <neilb@suse.de>2012-10-04 16:34:20 +1000
committerNeilBrown <neilb@suse.de>2012-10-04 16:34:20 +1000
commit7103b9b88d8c27989e17c80d7296eda97370dc1e (patch)
tree225ef68ca743ca2bdf6e70a7581ac82aebfa29db /Detail.c
parent9eafa1de73d1bd0b2ac0275d1389824825647df7 (diff)
Handles spaces in array names better.
1/ When printing the "name=" entry for --brief output, enclose name in quotes if it contains spaces etc. Quotes are already supported for reading mdadm.conf 2/ When a name is used as a device name, translate spaces and tabs to '_', as well as the current translation of '/' to '-'. Signed-off-by: NeilBrown <neilb@suse.de>
Diffstat (limited to 'Detail.c')
-rw-r--r--Detail.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/Detail.c b/Detail.c
index 9bf20618..8ca3a962 100644
--- a/Detail.c
+++ b/Detail.c
@@ -206,8 +206,11 @@ int Detail(char *dev, struct context *c)
printf("MD_UUID=%s\n", nbuf+5);
mp = map_by_uuid(&map, info->uuid);
if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0)
- printf("MD_DEVNAME=%s\n", mp->path+8);
+ strncmp(mp->path, "/dev/md/", 8) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path+8);
+ putchar('\n');
+ }
if (st->ss->export_detail_super)
st->ss->export_detail_super(st);
@@ -220,8 +223,11 @@ int Detail(char *dev, struct context *c)
printf("MD_UUID=%s\n", nbuf+5);
}
if (mp && mp->path &&
- strncmp(mp->path, "/dev/md/", 8) == 0)
- printf("MD_DEVNAME=%s\n", mp->path+8);
+ strncmp(mp->path, "/dev/md/", 8) == 0) {
+ printf("MD_DEVNAME=");
+ print_escape(mp->path+8);
+ putchar('\n');
+ }
}
goto out;
}