[PATCH] D68164: [Commandline] Clear error on raw_ostream when there is parsing error.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Sep 29 22:43:12 PDT 2019


ruiu added a comment.

In D68164#1687414 <https://reviews.llvm.org/D68164#1687414>, @MaskRay wrote:

> POSIX has stated that file descriptors 0, 1 or 2 should not be closed. The is stated in many parts, e.g.
>
> > Applications should not execute programs with file descriptor 0 not open for reading or with file descriptor 1 or 2 not open for writing, as this might cause the executed program to misbehave.  In order not to pass on these file descriptors to an executed program, applications should not just close them but should reopen them on, for example, /dev/null.
>
> The change is justified if you can give an example of a different file descriptor.


I believe that sentence is talking about stdin/stdout/stderr and forking a new process. As long as you don't create a new process, I think you are free to close 0, 1 and 2.

That said I agree with you that we shouldn't close 0, 1 and 2 on exit. I'm not sure if we are doing this at the moment, but if we do, I think we should stop doing that.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68164/new/

https://reviews.llvm.org/D68164





More information about the llvm-commits mailing list