From 4a03cbd10b4444710a52824476a71994632e0237 Mon Sep 17 00:00:00 2001 From: "mwilck@arcor.de" Date: Mon, 8 Jul 2013 23:50:46 +0200 Subject: DDF: guid_str: more readable output Print ASCII characters as ASCII Signed-off-by: NeilBrown --- super-ddf.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'super-ddf.c') diff --git a/super-ddf.c b/super-ddf.c index 1cb0a9fe..428e8f3b 100644 --- a/super-ddf.c +++ b/super-ddf.c @@ -1301,8 +1301,13 @@ static const char *guid_str(const char *guid) static char buf[DDF_GUID_LEN*2+1]; int i; char *p = buf; - for (i = 0; i < DDF_GUID_LEN; i++) - p += sprintf(p, "%02x", (unsigned char)guid[i]); + for (i = 0; i < DDF_GUID_LEN; i++) { + unsigned char c = guid[i]; + if (c >= 32 && c < 127) + p += sprintf(p, "%c", c); + else + p += sprintf(p, "%02x", c); + } *p = '\0'; return (const char *) buf; } -- cgit v1.2.3