Illumos 4448 - zfs diff misprints unicode characters
4448 zfs diff misprints unicode characters Reviewed by: Igor Kozhukhov <ikozhukhov@gmail.com> Reviewed by: Toomas Soome <tsoome@me.com> Approved by: Matthew Ahrens <mahrens@delphix.com> References: https://www.illumos.org/issues/4448 https://github.com/illumos/illumos-gate/commit/b211eb9 Porting Notes: - [lib/libzfs/libzfs_diff.c] -38145d6
Ensure that zfs diff prints unicode safely. -141b638
Change 3-digit octal escapes to 4-digit ones Ported-by: kernelOfTruth kerneloftruth@gmail.com Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
This commit is contained in:
parent
e989f19cba
commit
007595564e
|
@ -22,7 +22,7 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
|
||||||
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
* Copyright 2015 Nexenta Systems, Inc. All rights reserved.
|
||||||
* Copyright 2015 Joyent, Inc.
|
* Copyright 2016 Joyent, Inc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -130,11 +130,14 @@ get_stats_for_obj(differ_info_t *di, const char *dsname, uint64_t obj,
|
||||||
static void
|
static void
|
||||||
stream_bytes(FILE *fp, const char *string)
|
stream_bytes(FILE *fp, const char *string)
|
||||||
{
|
{
|
||||||
while (*string) {
|
char c;
|
||||||
if (*string > ' ' && *string != '\\' && *string < '\177')
|
|
||||||
(void) fprintf(fp, "%c", *string++);
|
while ((c = *string++) != '\0') {
|
||||||
else
|
if (c > ' ' && c != '\\' && c < '\177') {
|
||||||
(void) fprintf(fp, "\\%04o", (unsigned char)*string++);
|
(void) fprintf(fp, "%c", c);
|
||||||
|
} else {
|
||||||
|
(void) fprintf(fp, "\\%04o", (uint8_t)c);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue