[Mplayer-cvslog] CVS: main/libmpdemux network.c,1.11,1.12

Bertrand Baudet bertrand at mplayer.dev.hu
Fri Dec 7 08:17:13 CET 2001


Update of /cvsroot/mplayer/main/libmpdemux
In directory mplayer:/var/tmp.root/cvs-serv6450

Modified Files:
	network.c 
Log Message:
Checked the return values on read.


Index: network.c
===================================================================
RCS file: /cvsroot/mplayer/main/libmpdemux/network.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- network.c	22 Nov 2001 17:14:26 -0000	1.11
+++ network.c	7 Dec 2001 07:17:05 -0000	1.12
@@ -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 );
 	}
 	




More information about the MPlayer-cvslog mailing list