aboutsummaryrefslogtreecommitdiffstats
path: root/src/slibc-human
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2015-11-14 16:34:16 +0100
committerMattias Andrée <maandree@operamail.com>2015-11-14 16:34:16 +0100
commitc8037b57598c527c4e08215f518cdb55d04580cd (patch)
treee7ecaf96d5f475a1012806f0fdb3e3b4618cb580 /src/slibc-human
parentdoc: cleanname is not symlink-safe either (diff)
downloadslibc-c8037b57598c527c4e08215f518cdb55d04580cd.tar.gz
slibc-c8037b57598c527c4e08215f518cdb55d04580cd.tar.bz2
slibc-c8037b57598c527c4e08215f518cdb55d04580cd.tar.xz
escape: 192 128 → \0
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to 'src/slibc-human')
-rw-r--r--src/slibc-human/escape.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/slibc-human/escape.c b/src/slibc-human/escape.c
index e3be732..9ba166a 100644
--- a/src/slibc-human/escape.c
+++ b/src/slibc-human/escape.c
@@ -108,7 +108,9 @@ char* escape(const char* restrict str, char quote)
case '\\': *w++ = '\\', *w++ = '\\'; break;
case 0x7F: *w++ = '\\', *w++ = '1', *w++ = '7', *w++ = '7'; break;
default:
- if (c == quote)
+ if ((unsigned int)c == 0xC0) && ((unsigned int)(r[1]) == 0x80)
+ *w++ = '\\', *w++ = '0', r++;
+ else if (c == quote)
*w++ = '\\', *w++ = quote;
else if (c < ' ')
*w++ = '\\',