changeset 3365:eb1c24557dad

Checked the return values on read.
author bertrand
date Fri, 07 Dec 2001 07:17:05 +0000
parents a00004754492
children 005b875788f7
files libmpdemux/network.c
diffstat 1 files changed, 13 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/libmpdemux/network.c	Fri Dec 07 05:55:04 2001 +0000
+++ b/libmpdemux/network.c	Fri Dec 07 07:17:05 2001 +0000
@@ -187,6 +187,13 @@
 		i = read( fd, response, BUFFER_SIZE ); 
 		if( i<0 ) {
 			printf("Read failed\n");
+			http_free( http_hdr );
+			return NULL;
+		}
+		if( i==0 ) {
+			printf("http_read_response read 0 -ie- EOF\n");
+			http_free( http_hdr );
+			return NULL;
 		}
 		http_response_append( http_hdr, response, i );
 	} while( !http_is_header_entire( http_hdr ) ); 
@@ -353,7 +360,12 @@
 	}
 
 	if( len<size ) {
-		len += read( fd, buffer+len, size-len );
+		int ret;
+		ret = read( fd, buffer+len, size-len );
+		if( ret==0 ) {
+			printf("nop_streaming_read read 0 -ie- EOF\n");
+		}
+		len += ret;
 //printf("read %d bytes from network\n", len );
 	}