mirror of
				https://github.com/PabloMK7/citra.git
				synced 2025-10-30 21:30:04 +00:00 
			
		
		
		
	file_util: Check fd before using dup
This commit is contained in:
		
							parent
							
								
									54385a54eb
								
							
						
					
					
						commit
						c7f8bc5582
					
				
					 1 changed files with 4 additions and 0 deletions
				
			
		|  | @ -1187,6 +1187,8 @@ void OpenFStream<std::ios_base::in>( | ||||||
|     boost_iostreams<boost::iostreams::file_descriptor_source>& fstream, |     boost_iostreams<boost::iostreams::file_descriptor_source>& fstream, | ||||||
|     const std::string& filename) { |     const std::string& filename) { | ||||||
|     IOFile file(filename, "r"); |     IOFile file(filename, "r"); | ||||||
|  |     if (file.GetFd() == -1) | ||||||
|  |         return; | ||||||
|     int fd = dup(file.GetFd()); |     int fd = dup(file.GetFd()); | ||||||
|     if (fd == -1) |     if (fd == -1) | ||||||
|         return; |         return; | ||||||
|  | @ -1199,6 +1201,8 @@ template <> | ||||||
| void OpenFStream<std::ios_base::out>( | void OpenFStream<std::ios_base::out>( | ||||||
|     boost_iostreams<boost::iostreams::file_descriptor_sink>& fstream, const std::string& filename) { |     boost_iostreams<boost::iostreams::file_descriptor_sink>& fstream, const std::string& filename) { | ||||||
|     IOFile file(filename, "w"); |     IOFile file(filename, "w"); | ||||||
|  |     if (file.GetFd() == -1) | ||||||
|  |         return; | ||||||
|     int fd = dup(file.GetFd()); |     int fd = dup(file.GetFd()); | ||||||
|     if (fd == -1) |     if (fd == -1) | ||||||
|         return; |         return; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue