mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	handle EOF correctly if it is read before the stream was created
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@1164 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									d1db037577
								
							
						
					
					
						commit
						b325e07c73
					
				
					 1 changed files with 13 additions and 9 deletions
				
			
		| 
						 | 
				
			
			@ -291,11 +291,12 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
 | 
			
		|||
 | 
			
		||||
    if ((r = read(fd, buffer, l)) <= 0) {
 | 
			
		||||
        if (r == 0) {
 | 
			
		||||
            pa_operation *o;
 | 
			
		||||
            
 | 
			
		||||
            if (verbose)
 | 
			
		||||
                fprintf(stderr, "Got EOF.\n");
 | 
			
		||||
 | 
			
		||||
            if (stream) {
 | 
			
		||||
                pa_operation *o;
 | 
			
		||||
            
 | 
			
		||||
                if (!(o = pa_stream_drain(stream, stream_drain_complete, NULL))) {
 | 
			
		||||
                    fprintf(stderr, "pa_stream_drain(): %s\n", pa_strerror(pa_context_errno(context)));
 | 
			
		||||
                    quit(1);
 | 
			
		||||
| 
						 | 
				
			
			@ -303,6 +304,9 @@ static void stdin_callback(pa_mainloop_api*a, pa_io_event *e, int fd, pa_io_even
 | 
			
		|||
                }
 | 
			
		||||
                
 | 
			
		||||
                pa_operation_unref(o);
 | 
			
		||||
            } else
 | 
			
		||||
                quit(0);
 | 
			
		||||
            
 | 
			
		||||
        } else {
 | 
			
		||||
            fprintf(stderr, "read() failed: %s\n", strerror(errno));
 | 
			
		||||
            quit(1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue