mirror of
https://github.com/gbdev/rgbds.git
synced 2026-10-06 04:05:38 +00:00
Avoid closing stdin/stdout/stderr standard streams
This commit is contained in:
1 parent
8ab6190f96
commit
e9fa1e4e94
11 files changed
+42
-22
No files matched your search
+1
-5
@@ -405,11 +405,7 @@ void LexerState::setFileAsNextState(std::string const &filePath, bool updateStat
|
||||
|
||||
if (fd >= 0) {
|
||||
// If the file is stdin, or if measuring its size failed, read it in pieces
|
||||
Defer closeFile{[&] {
|
||||
if (fd != STDIN_FILENO) {
|
||||
close(fd);
|
||||
}
|
||||
}};
|
||||
Defer closeFile{[&] { xclose(fd); }};
|
||||
|
||||
// Reasonably large buffer size for `read` performance
|
||||
char buf[8192];
|
||||
|
||||
Reference in new issue
Block a user