diff options
Diffstat (limited to 'src/input/mms.c')
-rw-r--r-- | src/input/mms.c | 36 |
1 files changed, 21 insertions, 15 deletions
diff --git a/src/input/mms.c b/src/input/mms.c index 6b5545577..e52f6277b 100644 --- a/src/input/mms.c +++ b/src/input/mms.c @@ -17,7 +17,7 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA * - * $Id: mms.c,v 1.20 2003/01/31 14:06:17 miguelfreitas Exp $ + * $Id: mms.c,v 1.21 2003/02/05 00:10:30 miguelfreitas Exp $ * * based on work from major mms * utility functions to handle communication with an mms server @@ -112,26 +112,32 @@ static ssize_t read_timeout(int fd, void *buf, size_t count) { while (total < count) { - fd_set rset; - struct timeval timeout; - - FD_ZERO (&rset); - FD_SET (fd, &rset); - - timeout.tv_sec = 30; - timeout.tv_usec = 0; - - if (select (fd+1, &rset, NULL, NULL, &timeout) <= 0) { - return -1; - } - ret=read (fd, ((uint8_t*)buf)+total, count-total); - if (ret<=0) { + if (ret<0) { + if(errno == EAGAIN) { + fd_set rset; + struct timeval timeout; + + FD_ZERO (&rset); + FD_SET (fd, &rset); + + timeout.tv_sec = 30; + timeout.tv_usec = 0; + + if (select (fd+1, &rset, NULL, NULL, &timeout) <= 0) { + return -1; + } + continue; + } + printf ("mms: read error.\n"); return ret; } else total += ret; + + /* end of stream */ + if (!ret) break; } #ifdef LOG |