openzfsonwindows / ZFSin

OpenZFS on Windows port
https://openzfsonwindows.org
1.2k stars 68 forks source link

fix zdb -R for raw flag #326

Open datacore-skumar opened 3 years ago

datacore-skumar commented 3 years ago

Write was returing wrong size due to some non printable characters in buffer So, I replaced Write with putchar.

lundman commented 3 years ago

Is this the sort of place that O_BINARY would affect the outcome?

datacore-skumar commented 3 years ago

The issue was with wrong file handle to WriteFile(). It's working fine after fixing the file handle.

lundman commented 3 years ago

Ah yep, the sort of thing "wosix.h" is supposed to hide, but it probably isn't used for zdb. This will do fine in ZFSin, but let's take the wosix approach in the new port..

lundman commented 3 years ago

What is the status here?

imtiazdc commented 3 years ago

What is the status here?

@lundman This could be merged in ZFSin. We tested this internally and found it working.

lundman commented 3 years ago

Ok, posix.c and wosix.h is supposed to wrap the write(_fileno(stdout), parts, with fileno going to HANDLE, and write using WriteFile(HANDLE, ... (although, its supposed to be fileno, not _fileno, since that will call Windows fileno and return a filedes.