aboutsummaryrefslogtreecommitdiffstats
path: root/lib/libzfs
diff options
context:
space:
mode:
authorнаб <[email protected]>2021-12-10 00:02:52 +0100
committerBrian Behlendorf <[email protected]>2021-12-13 15:49:40 -0800
commit344bbc82e7054f61d5e7b3610b119820285fd2cb (patch)
treea0ac59fe3b3d2c64d5f8495f035e3563d0413f6c /lib/libzfs
parentf04b97620059d08b37d9e80ada397e742bb2f311 (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]> Closes #12829
Diffstat (limited to 'lib/libzfs')
-rw-r--r--lib/libzfs/libzfs_diff.c10
-rw-r--r--lib/libzfs/libzfs_impl.h1
2 files changed, 9 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];
diff --git a/lib/libzfs/libzfs_impl.h b/lib/libzfs/libzfs_impl.h
index b1cf4f825..33b3feed4 100644
--- a/lib/libzfs/libzfs_impl.h
+++ b/lib/libzfs/libzfs_impl.h
@@ -232,6 +232,7 @@ typedef struct differ_info {
boolean_t scripted;
boolean_t classify;
boolean_t timestamped;
+ boolean_t no_mangle;
uint64_t shares;
int zerr;
int cleanupfd;