mirror of
				https://github.com/alsa-project/alsa-lib.git
				synced 2025-11-03 09:01:52 -05:00 
			
		
		
		
	pcm: share plugin: handle -EINTR
Fixes: https://github.com/alsa-project/alsa-lib/pull/242
Fixes: b97047b4 ("pcm: share plugin: return error if socket read or write call fails")
Signed-off-by: Jaroslav Kysela <perex@perex.cz>
			
			
This commit is contained in:
		
							parent
							
								
									b97047b450
								
							
						
					
					
						commit
						65c4796a85
					
				
					 1 changed files with 18 additions and 12 deletions
				
			
		| 
						 | 
					@ -289,19 +289,25 @@ static snd_pcm_uframes_t _snd_pcm_share_missing(snd_pcm_t *pcm)
 | 
				
			||||||
 update_poll:
 | 
					 update_poll:
 | 
				
			||||||
	if (ready != share->ready) {
 | 
						if (ready != share->ready) {
 | 
				
			||||||
		char buf[1];
 | 
							char buf[1];
 | 
				
			||||||
		if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
 | 
							while (1) {
 | 
				
			||||||
			if (ready)
 | 
								if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
 | 
				
			||||||
				s = read(share->slave_socket, buf, 1);
 | 
									if (ready)
 | 
				
			||||||
			else
 | 
										s = read(share->slave_socket, buf, 1);
 | 
				
			||||||
				s = write(share->client_socket, buf, 1);
 | 
									else
 | 
				
			||||||
		} else {
 | 
										s = write(share->client_socket, buf, 1);
 | 
				
			||||||
			if (ready)
 | 
								} else {
 | 
				
			||||||
				s = write(share->slave_socket, buf, 1);
 | 
									if (ready)
 | 
				
			||||||
			else
 | 
										s = write(share->slave_socket, buf, 1);
 | 
				
			||||||
				s = read(share->client_socket, buf, 1);
 | 
									else
 | 
				
			||||||
 | 
										s = read(share->client_socket, buf, 1);
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								if (s < 0) {
 | 
				
			||||||
 | 
									if (errno == EINTR)
 | 
				
			||||||
 | 
										continue;
 | 
				
			||||||
 | 
									return INT_MAX;
 | 
				
			||||||
 | 
								}
 | 
				
			||||||
 | 
								break;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (s == -1)
 | 
					 | 
				
			||||||
			return INT_MAX;
 | 
					 | 
				
			||||||
		share->ready = ready;
 | 
							share->ready = ready;
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
	if (!running)
 | 
						if (!running)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue