mirror of
https://github.com/Lime3DS/Lime3DS.git
synced 2024-11-23 18:19:21 +01:00
Merge pull request #6368 from GPUCode/msvc-dup
Check fd before using dup
This commit is contained in:
commit
5317c00c45
@ -1187,6 +1187,8 @@ void OpenFStream<std::ios_base::in>(
|
||||
boost_iostreams<boost::iostreams::file_descriptor_source>& fstream,
|
||||
const std::string& filename) {
|
||||
IOFile file(filename, "r");
|
||||
if (file.GetFd() == -1)
|
||||
return;
|
||||
int fd = dup(file.GetFd());
|
||||
if (fd == -1)
|
||||
return;
|
||||
@ -1199,6 +1201,8 @@ template <>
|
||||
void OpenFStream<std::ios_base::out>(
|
||||
boost_iostreams<boost::iostreams::file_descriptor_sink>& fstream, const std::string& filename) {
|
||||
IOFile file(filename, "w");
|
||||
if (file.GetFd() == -1)
|
||||
return;
|
||||
int fd = dup(file.GetFd());
|
||||
if (fd == -1)
|
||||
return;
|
||||
|
Loading…
Reference in New Issue
Block a user