mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 19:22:45 +00:00 
			
		
		
		
	FIFO: Let write() fail with EPIPE if there's no reader.
This commit is contained in:
		
							parent
							
								
									6fa727a88e
								
							
						
					
					
						commit
						1f17b40d00
					
				
					 1 changed files with 2 additions and 2 deletions
				
			
		|  | @ -88,7 +88,7 @@ bool FIFO::can_read(FileDescriptor&) const | |||
| 
 | ||||
| bool FIFO::can_write(FileDescriptor&) const | ||||
| { | ||||
|     return m_buffer.bytes_in_write_buffer() < 4096; | ||||
|     return m_buffer.bytes_in_write_buffer() < 4096 || !m_readers; | ||||
| } | ||||
| 
 | ||||
| ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size) | ||||
|  | @ -108,7 +108,7 @@ ssize_t FIFO::read(FileDescriptor&, byte* buffer, ssize_t size) | |||
| ssize_t FIFO::write(FileDescriptor&, const byte* buffer, ssize_t size) | ||||
| { | ||||
|     if (!m_readers) | ||||
|         return 0; | ||||
|         return -EPIPE; | ||||
| #ifdef FIFO_DEBUG | ||||
|     dbgprintf("fifo: write(%p, %u)\n", buffer, size); | ||||
| #endif | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling