msvcrt: Fix EOF behavior on read from pipe

Damjan Jovanovic damjan.jov at gmail.com
Sat Feb 9 04:15:38 CST 2008


On Feb 8, 2008 8:03 PM, Dan Kegel <dank at kegel.com> wrote:
> Damjan wrote
> > The problem is more general: consoles *also* break on short reads
> > (Java 1.4.1's gdb takes 1 command then quits because it thinks it's
> > the end of file)
>
> Try my patch, it should help that case.

It only helps if I change

+            if (type != FILE_TYPE_PIPE) {

to

+            if (type != FILE_TYPE_PIPE && type != FILE_TYPE_CHAR) {

> > I'm sure short read != end of file for ordinary
> > files either, especially in *nix where read() can easily be
> > interrupted by a signal.
>
> If you can come up with an example of a real
> app or even a test case that is currently broken,
> I'll gladly try to fix it.

Well, if the MSDN is correct about ReadFile() returning only when the
requested number of bytes is read unless an error occurs (it's a big
if :-), then it would be an NTDLL NtReadFile() issue where pread()
returns too soon due to a signal. But I haven't been able to get a
signal to interrupt pread() in my tests, maybe wine handles signals.

> - Dan
>

Thank you
Damjan



More information about the wine-devel mailing list