summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorKarel Zak2017-12-20 12:29:16 +0100
committerKarel Zak2017-12-20 12:29:16 +0100
commit33d2e5a1ed1c6a362bd36dc0e08b679eee674343 (patch)
treeaffec0b8d94705c2a826c8942b47f3ed55dea9ce /lib
parenttests: don't use mount.<type> helpers in mount-by-pattern tests (diff)
parentlibfdisk: return bytes processed from gpt_entry_set_name(), process rc (diff)
downloadkernel-qcow2-util-linux-33d2e5a1ed1c6a362bd36dc0e08b679eee674343.tar.gz
kernel-qcow2-util-linux-33d2e5a1ed1c6a362bd36dc0e08b679eee674343.tar.xz
kernel-qcow2-util-linux-33d2e5a1ed1c6a362bd36dc0e08b679eee674343.zip
Merge branch 'gpt-part-name' of https://github.com/yontalcar/util-linux
* 'gpt-part-name' of https://github.com/yontalcar/util-linux: libfdisk: return bytes processed from gpt_entry_set_name(), process rc libfdisk: allocate enough bytes for ucs2 to utf8 encoding libfdisk: gpt: properly encode string on rename lib/mbsalign: encode backslash to prevent ambiguity
Diffstat (limited to 'lib')
-rw-r--r--lib/mbsalign.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/mbsalign.c b/lib/mbsalign.c
index 78ab12a0d..dce1a1321 100644
--- a/lib/mbsalign.c
+++ b/lib/mbsalign.c
@@ -54,7 +54,7 @@ size_t mbs_safe_nwidth(const char *buf, size_t bufsz, size_t *sz)
last = p + (bufsz - 1);
while (p && *p && p <= last) {
- if (iscntrl((unsigned char) *p)) {
+ if (*p == '\\' || iscntrl((unsigned char) *p)) {
width += 4, bytes += 4; /* *p encoded to \x?? */
p++;
}
@@ -135,7 +135,7 @@ char *mbs_safe_encode_to_buffer(const char *s, size_t *width, char *buf, const c
continue;
}
- if (iscntrl((unsigned char) *p)) {
+ if (*p == '\\' || iscntrl((unsigned char) *p)) {
sprintf(r, "\\x%02x", (unsigned char) *p);
r += 4;
*width += 4;