serial-port: if 0 bytes are read, just return

Otherwise, if something else is mistakenly holding the serial port open at
the same time as this MMSerialPort, you get a stream of reads of size 0 and
effectively hang modem-manager.
This commit is contained in:
Dan Williams
2009-06-25 14:14:10 -04:00
parent 742bf7d17c
commit bb50295e5e
+4
View File
@@ -620,6 +620,10 @@ data_available (GIOChannel *source,
err = NULL;
}
/* If no bytes read, just let g_io_channel wait for more data */
if (bytes_read == 0)
break;
if (bytes_read > 0) {
serial_debug (self, "<--", buf, bytes_read);
g_string_append_len (priv->response, buf, bytes_read);