summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-12-10 00:02:52 +0100
committerBrian Behlendorf <[email protected]>2022-04-01 09:58:45 -0700
commit5a21214be84e4b00f419220e4da51f16cee13cad (patch)
treef9f42c1851816b01a8bfbbcb6db684865e8b7109 /lib
parent52bad4f23daaa5f827f802c8d05785a27b80275d (diff)
zfs, libzfs: diff: accept -h/ZFS_DIFF_NO_MANGLE, disabling path escaping
Reviewed-by: Brian Behlendorf <[email protected]> Reviewed-by: Rich Ercolani <[email protected]> Signed-off-by: Ahelenia Ziemiańska <[email protected]> Upstream-commit: 344bbc82e7054f61d5e7b3610b119820285fd2cb Closes #12829
Diffstat (limited to 'lib')
-rw-r--r--lib/libzfs/libzfs_diff.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/libzfs/libzfs_diff.c b/lib/libzfs/libzfs_diff.c
index d46e23a2f..b721a9fd9 100644
--- a/lib/libzfs/libzfs_diff.c
+++ b/lib/libzfs/libzfs_diff.c
@@ -176,8 +176,13 @@ print_what(FILE *fp, mode_t what)
static void
print_cmn(FILE *fp, differ_info_t *di, const char *file)
{
- stream_bytes(fp, di->dsmnt);
- stream_bytes(fp, file);
+ if (!di->no_mangle) {
+ stream_bytes(fp, di->dsmnt);
+ stream_bytes(fp, file);
+ } else {
+ (void) fputs(di->dsmnt, fp);
+ (void) fputs(file, fp);
+ }
}
static void
@@ -752,6 +757,7 @@ zfs_show_diffs(zfs_handle_t *zhp, int outfd, const char *fromsnap,
di.scripted = (flags & ZFS_DIFF_PARSEABLE);
di.classify = (flags & ZFS_DIFF_CLASSIFY);
di.timestamped = (flags & ZFS_DIFF_TIMESTAMP);
+ di.no_mangle = (flags & ZFS_DIFF_NO_MANGLE);
di.outputfd = outfd;
di.datafd = pipefd[0];