In some (impossible) circumstances rbytes and err might be used
uninitialized. Here we make a check that a read was actually attempted
before checking those variables.
do {
toread = ring_buffer_avail_no_wrap(chat->buf);
do {
toread = ring_buffer_avail_no_wrap(chat->buf);
- if (toread == 0) {
- err = G_IO_ERROR_NONE;
rbytes = 0;
buf = ring_buffer_write_ptr(chat->buf);
rbytes = 0;
buf = ring_buffer_write_ptr(chat->buf);
if (cond & (G_IO_HUP | G_IO_ERR))
return FALSE;
if (cond & (G_IO_HUP | G_IO_ERR))
return FALSE;
- if (rbytes == 0 && err != G_IO_ERROR_AGAIN)
+ if (read_count > 0 && rbytes == 0 && err != G_IO_ERROR_AGAIN)
return FALSE;
return TRUE;
return FALSE;
return TRUE;