From 9c6c34a98fe7f11b81a9ee8c687e07c126335e74 Mon Sep 17 00:00:00 2001 From: mav Date: Mon, 21 Mar 2016 00:27:00 +0000 Subject: [PATCH] MFC r296541: MFV r296540: 4448 zfs diff misprints unicode characters Reviewed by: Igor Kozhukhov Reviewed by: Toomas Soome Approved by: Matthew Ahrens Author: Joshua M. Clulow illumos/illumos-gate@b211eb9181f99c20acbf4c528f94cb44b4ca8c31 git-svn-id: svn://svn.freebsd.org/base/stable/10@297121 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- .../opensolaris/lib/libzfs/common/libzfs_diff.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c index bb49eba0f..28b1e2e12 100644 --- a/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c +++ b/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_diff.c @@ -22,6 +22,7 @@ /* * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved. * Copyright 2015 Nexenta Systems, Inc. All rights reserved. + * Copyright 2016 Joyent, Inc. */ /* @@ -136,12 +137,13 @@ get_stats_for_obj(differ_info_t *di, const char *dsname, uint64_t obj, static void stream_bytes(FILE *fp, const char *string) { - while (*string) { - if (*string > ' ' && *string != '\\' && *string < '\177') - (void) fprintf(fp, "%c", *string++); - else { - (void) fprintf(fp, "\\%03hho", - (unsigned char)*string++); + char c; + + while ((c = *string++) != '\0') { + if (c > ' ' && c != '\\' && c < '\177') { + (void) fprintf(fp, "%c", c); + } else { + (void) fprintf(fp, "\\%03o", (uint8_t)c); } } } -- 2.45.0