From: Sage Weil Date: Fri, 14 Oct 2016 19:35:58 +0000 (-0400) Subject: os/kstore: fix escaping of chars > 0x80 in keys X-Git-Tag: v11.1.0~620^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=659da5f16d662c771632d927906516f3fbfdda1e;p=ceph.git os/kstore: fix escaping of chars > 0x80 in keys Signed-off-by: Sage Weil --- diff --git a/src/os/kstore/KStore.cc b/src/os/kstore/KStore.cc index 31af5c27551..e4498192fd4 100755 --- a/src/os/kstore/KStore.cc +++ b/src/os/kstore/KStore.cc @@ -84,10 +84,10 @@ static void append_escaped(const string &in, string *out) char hexbyte[8]; for (string::const_iterator i = in.begin(); i != in.end(); ++i) { if (*i <= '#') { - snprintf(hexbyte, sizeof(hexbyte), "#%02x", (unsigned)*i); + snprintf(hexbyte, sizeof(hexbyte), "#%02x", (uint8_t)*i); out->append(hexbyte); } else if (*i >= '~') { - snprintf(hexbyte, sizeof(hexbyte), "~%02x", (unsigned)*i); + snprintf(hexbyte, sizeof(hexbyte), "~%02x", (uint8_t)*i); out->append(hexbyte); } else { out->push_back(*i);