mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Added handling for pipe closing.
svn path=/trunk/; revision=2928
This commit is contained in:
parent
eb12656476
commit
ad703f36f3
1 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue