From: Neil Brown Date: Sun, 8 Feb 2009 02:48:19 +0000 (+1100) Subject: Be more careful about handing EOF read from the socket. X-Git-Url: http://git.neil.brown.name/?a=commitdiff_plain;p=gsm0710muxd.git Be more careful about handing EOF read from the socket. There was a case were we would spin on EOF from the socket. --- diff --git a/src/gsm0710muxd.c b/src/gsm0710muxd.c index 70d41cf..ca67b12 100644 --- a/src/gsm0710muxd.c +++ b/src/gsm0710muxd.c @@ -607,7 +607,8 @@ gboolean pseudo_device_read(GIOChannel *source, GIOCondition condition, gpointer unsigned char buf[4096]; //information from virtual port int len = read(channel->fd, buf + channel->remaining, sizeof(buf) - channel->remaining); - if (!channel->opened) + + if (len > 0 && !channel->opened) { LOG(LOG_WARNING, "Write to a channel which wasn't acked to be open."); write_frame(channel->id, NULL, 0, GSM0710_TYPE_SABM | GSM0710_PF);