Commit e58ae413 e58ae41328ab2134cc888355596c985bd7345986 by Alain Magloire

Bugfix in stream.c (stream_wait) should return true if we have something in the cache.

1 parent 8f6a087a
1 /* GNU Mailutils -- a suite of utilities for electronic mail 1 /* GNU Mailutils -- a suite of utilities for electronic mail
2 Copyright (C) 1999, 2000 Free Software Foundation, Inc. 2 Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc.
3 3
4 This library is free software; you can redistribute it and/or 4 This library is free software; you can redistribute it and/or
5 modify it under the terms of the GNU Lesser General Public 5 modify it under the terms of the GNU Lesser General Public
......
...@@ -774,6 +774,18 @@ stream_wait (stream_t stream, int *pflags, struct timeval *tvp) ...@@ -774,6 +774,18 @@ stream_wait (stream_t stream, int *pflags, struct timeval *tvp)
774 { 774 {
775 if (stream == NULL) 775 if (stream == NULL)
776 return EINVAL; 776 return EINVAL;
777
778 /* Take to acount if we have any buffering. */
779 if ((*pflags) & MU_STREAM_READY_RD)
780 {
781 if (stream->rbuffer.count > 0)
782 {
783 *pflags = 0;
784 *pflags |= MU_STREAM_READY_RD;
785 return 0;
786 }
787 }
788
777 if (stream->_wait) 789 if (stream->_wait)
778 return stream->_wait (stream, pflags, tvp); 790 return stream->_wait (stream, pflags, tvp);
779 return ENOSYS; 791 return ENOSYS;
......