Added handling for pipe closing.

svn path=/trunk/; revision=2928
This commit is contained in:
Hartmut Birr 2002-05-07 22:32:13 +00:00
parent eb12656476
commit ad703f36f3

View file

@ -1,4 +1,5 @@
/* /* $Id: read.c,v 1.6 2002/05/07 22:32:13 hbirr Exp $
*
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
* FILE: lib/msvcrt/io/read.c * FILE: lib/msvcrt/io/read.c
@ -22,7 +23,7 @@ size_t _read(int _fd, void *_buf, size_t _nbyte)
DWORD _rbyte = 0, nbyte = _nbyte; DWORD _rbyte = 0, nbyte = _nbyte;
char *bufp = (char*)_buf; char *bufp = (char*)_buf;
HANDLE hfile; HANDLE hfile;
int istext; int istext, error;
DPRINT("_read(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte); DPRINT("_read(fd %d, buf %x, nbyte %d)\n", _fd, _buf, _nbyte);
@ -37,6 +38,11 @@ size_t _read(int _fd, void *_buf, size_t _nbyte)
if (!ReadFile(hfile, bufp, nbyte, &_rbyte, NULL)) if (!ReadFile(hfile, bufp, nbyte, &_rbyte, NULL))
{ {
/* failure */ /* failure */
error = GetLastError();
if (error == ERROR_BROKEN_PIPE)
{
return 0;
}
return -1; return -1;
} }