diff options
author | Ken Brown <kbrown@cornell.edu> | 2019-04-14 19:15:58 +0000 |
---|---|---|
committer | Corinna Vinschen <corinna@vinschen.de> | 2019-04-16 12:54:43 +0200 |
commit | 513f050cbf1b9e1ac40e08d258e496272bde920f (patch) | |
tree | 7653678042c99924b4714cff05230dadd148eb8e | |
parent | 0c72e766e2bd4b504030a502c0c46e41d268e052 (diff) | |
download | cygnal-513f050cbf1b9e1ac40e08d258e496272bde920f.tar.gz cygnal-513f050cbf1b9e1ac40e08d258e496272bde920f.tar.bz2 cygnal-513f050cbf1b9e1ac40e08d258e496272bde920f.zip |
Cygwin: FIFO: fix the error checking in raw_read
If the pipe is empty, we can get either ERROR_NO_DATA or
ERROR_PIPE_LISTENING.
-rw-r--r-- | winsup/cygwin/fhandler_fifo.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/winsup/cygwin/fhandler_fifo.cc b/winsup/cygwin/fhandler_fifo.cc index 764420ffd..2da579b95 100644 --- a/winsup/cygwin/fhandler_fifo.cc +++ b/winsup/cygwin/fhandler_fifo.cc @@ -749,19 +749,16 @@ fhandler_fifo::raw_read (void *in_ptr, size_t& len) fifo_client_unlock (); return; } - /* In the duplex case with no data, we seem to get nread - == -1 with ERROR_PIPE_LISTENING on the first attempt to - read from the duplex pipe (fc_handler[0]), and nread == 0 - on subsequent attempts. */ + /* If the pipe is empty, we usually get nread == -1 with + ERROR_NO_DATA or ERROR_PIPE_LISTENING. An exception is + that in the duplex case we may get nread == 0 when we + attempt to read from the duplex pipe (fc_handler[0]). */ else if (nread < 0) switch (GetLastError ()) { case ERROR_NO_DATA: - break; case ERROR_PIPE_LISTENING: - if (_duplexer && i == 0) - break; - /* Fall through. */ + break; default: fifo_client_unlock (); goto errout; |