[PATCH] D61326: Fixes for builds that require strict X/Open and POSIX compatiblity

David Tenty via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri May 10 18:10:07 PDT 2019


daltenty marked 3 inline comments as done.
daltenty added inline comments.


================
Comment at: llvm/lib/Support/Unix/Memory.inc:146
+#if !defined(MAP_ANON) 
+  close(fd);
+#endif 
----------------
hubert.reinterpretcast wrote:
> If it's okay to close the file here, then it is okay to close the file right after the call to `mmap` before checking whether `mmap` failed. We would only need to add one call to `close` (instead of three).
If we close right after mmap, that would technically render the value of errno undefined or clobber it, and we may need to inspect it if the mmap failed (and according to spec we should only manipulate it if mmap failed)


Repository:
  rL LLVM

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

https://reviews.llvm.org/D61326





More information about the llvm-commits mailing list