From fa1c330066675acb701118feedcc64f5a3b7a0fa Mon Sep 17 00:00:00 2001 From: Shashank Kumar Date: Tue, 19 Jan 2021 15:36:55 +0530 Subject: [PATCH] fix zdb -R for raw flag Write was returing wrong size due to some non printable characters in buffer So, I replaced Write with putchar. --- ZFSin/zfs/cmd/zdb/zdb.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ZFSin/zfs/cmd/zdb/zdb.c b/ZFSin/zfs/cmd/zdb/zdb.c index 0fc523da..ef808366 100644 --- a/ZFSin/zfs/cmd/zdb/zdb.c +++ b/ZFSin/zfs/cmd/zdb/zdb.c @@ -5059,9 +5059,11 @@ zdb_dump_gbh(void *buf, int flags) static void zdb_dump_block_raw(void *buf, uint64_t size, int flags) { + unsigned char* str = buf; if (flags & ZDB_FLAG_BSWAP) byteswap_uint64_array(buf, size); - VERIFY(write(_fileno(stdout), buf, size) == size); + for (int i = 0; i < size; i++) + (void)putchar(str[i]); } static void