From: mwilck@arcor.de Date: Mon, 8 Jul 2013 21:50:46 +0000 (+0200) Subject: DDF: guid_str: more readable output X-Git-Tag: mdadm-3.3-rc2~31 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4a03cbd10b4444710a52824476a71994632e0237;p=thirdparty%2Fmdadm.git DDF: guid_str: more readable output Print ASCII characters as ASCII Signed-off-by: NeilBrown --- 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; }