[PATCH] D40032: [compiler-rt] Replace forkpty with posix_spawn
Kuba (Brecka) Mracek via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Feb 8 11:01:22 PST 2018
kubamracek added a comment.
Updated patch.
================
Comment at: lib/sanitizer_common/sanitizer_mac.cc:261
+ cleanup:
+ if (master_fd != kInvalidFd) internal_close(master_fd);
+ if (slave_fd != kInvalidFd) internal_close(slave_fd);
----------------
george.karpenkov wrote:
> could the error happen after the file descriptor was set? (e.g. system call fails, but the pointer was still written into?) Might be safer to have multiple cleanup labels to jump to the one where you know it's safe to close the descriptor?
I don't think this can happen. Both `master_fd` and `slave_fd` are only assigned directly in the code above, there's no pointers involved. I think it's pretty safe to say that they're either `kInvalidFd` or valid fds that need to be closed.
https://reviews.llvm.org/D40032
More information about the llvm-commits
mailing list