Skip to content

Commit 874a3ba

Browse files
authored
[flang][runtime] Don't buffer unit 0 (#122614)
Always assume that predefined unit 0 is a terminal, so that output to it is never buffered.
1 parent bf95854 commit 874a3ba

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

flang/runtime/file.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ void OpenFile::Open(OpenStatus status, Fortran::common::optional<Action> action,
134134
if (fd_ >= 0 && position == Position::Append && !RawSeekToEnd()) {
135135
handler.SignalError(IostatOpenBadAppend);
136136
}
137-
isTerminal_ = fd_ >= 0 && IsATerminal(fd_) == 1;
137+
isTerminal_ = fd_ >= 0 && IsATerminal(fd_);
138138
mayRead_ = *action != Action::Write;
139139
mayWrite_ = *action != Action::Read;
140140
if (status == OpenStatus::Old || status == OpenStatus::Unknown) {
@@ -163,7 +163,7 @@ void OpenFile::Predefine(int fd) {
163163
knownSize_.reset();
164164
nextId_ = 0;
165165
pending_.reset();
166-
isTerminal_ = IsATerminal(fd_) == 1;
166+
isTerminal_ = fd == 2 || IsATerminal(fd_);
167167
mayRead_ = fd == 0;
168168
mayWrite_ = fd != 0;
169169
mayPosition_ = false;

0 commit comments

Comments
 (0)