[PATCH] D13128: Fix backend crash on multiple close of stdout.

Yaron Keren via cfe-commits cfe-commits at lists.llvm.org
Thu Sep 24 07:26:00 PDT 2015

yaron.keren added a subscriber: sunfish.
yaron.keren added a comment.

The original commit http://lists.llvm.org/pipermail/llvm-commits/Week-of-Mon-20100816/106268.html by Dan Ghoman says:

"Make raw_fd_ostream consider itself the owner of STDOUT_FILENO when
constructed with an output filename of "-". In particular, allow the
file descriptor to be closed, and close the file descriptor in the
destructor if it hasn't been explicitly closed already, to ensure
that any write errors are detected."

Closing stdout causes not only this problem in the 2nd close (which may be worked around) but potentially losing text output depending on who gets to close the stream first. Is it normal behaviour for console programs to close their stdout?


More information about the cfe-commits mailing list