zfs, libzfs: diff: accept -h/ZFS_DIFF_NO_MANGLE, disabling path escaping

Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Reviewed-by: Rich Ercolani <rincebrain@gmail.com>
Signed-off-by: Ahelenia Ziemiańska <nabijaczleweli@nabijaczleweli.xyz>
Closes #12829
This commit is contained in:
наб
2021-12-10 00:02:52 +01:00
committed by Brian Behlendorf
parent f04b976200
commit 344bbc82e7
9 changed files with 74 additions and 10 deletions
+8 -2
View File
@@ -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];
+1
View File
@@ -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;